Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2005-09-07
22:31 • Ticket [1283976fff] Tcl_UniCharToUtf mishandles negative input status still ... artifact: 5f9e4c9e0e user: dgp
22:31 • Closed ticket [1283976fff]. artifact: 22624d729c user: dgp
21:32 • Ticket [1283976fff]: 4 changes artifact: 39f50cd729 user: dgp
21:32 • Add attachment 1283976-85.patch to ticket [1283976fff] artifact: 12726572bb user: dgp
21:32 • Ticket [1283976fff] Tcl_UniCharToUtf mishandles negative input status still ... artifact: 50b843b002 user: dgp
21:22 • Ticket [1283976fff]: 4 changes artifact: 9922626919 user: dgp
21:22 • Add attachment 1283976.patch to ticket [1283976fff] artifact: bb9da4079c user: dgp
21:22 • Ticket [1283976fff] Tcl_UniCharToUtf mishandles negative input status still ... artifact: 0e40333ee3 user: dgp
13:55 • New ticket [1283976fff]. artifact: fbe3dcbbec user: dgp

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: