Tcl_UniCharToUtf mishandles negative input
Closed / Fixed1283976fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-09-07 13:55:34
dkf% scan [format %c -1] %c%c%c
255 191 {}
...
[09:43]dkf% string bytelength [format %c -1]
2
...
[09:43]dkfSo, [format %c -1] is *wrong*
...
[09:44]dgphmmm... Tcl_UniCharToUtf accepts an "int"
argument instead of a "Tcl_UniChar" one.
[09:44]dkfI think that's because some compilers
aren't keen on arguments narrower than a word
[09:45]dgpbut the logic of the routine assumes an
unsigned input.
rmaxdgp: IIRC I also wondered about this when I worked
on the -nocase stuff some time ago, and Jeff knew the
reason why it is so.
[09:45]dkfI think T_UCTU should cast it's argument to
Tcl_UniChar
[09:46]dkf(at the very least)
...
[09:49]dgpok, so the flaw is in T_UCTU and not
[format] itself ten
[09:53]dkf[format] shouldn't be able to step outside
the internal encoding model
dgpplain2005-09-07 21:22:25
Logged In: YES user_id=80530 attached patch is fix and test
dgpplain2005-09-07 21:22:33
File Added - 148328: 1283976.patch
dgpplain2005-09-07 21:32:13
Logged In: YES user_id=80530 corresponding patch for the HEAD
dgpplain2005-09-07 21:32:21
File Added - 148329: 1283976-85.patch
dgp Closed ticket [1283976fff].
[History diff]2005-09-07 22:31:42
dgpplain2005-09-07 22:31:43
Logged In: YES user_id=80530 patches committed.
Log in (anonymous is fine) to add a comment.
Attachments:
- 1283976-85.patch [download] added by dgp on 2005-09-07 21:32:19. [details]
- 1283976.patch [download] added by dgp on 2005-09-07 21:22:31. [details]