|
2004-10-27
| ||
| 05:01 | • Ticket [1036649fff] Buffer overrun in subst status still Closed with 1 oth... artifact: 72e9a2a9a1 user: dgp | |
| 04:58 | • Closed ticket [1036649fff]. artifact: 575a6c3c33 user: dgp | |
| 03:54 | • Ticket [1036649fff]: 4 changes artifact: 9f5400f6f4 user: dgp | |
|
2004-09-30
| ||
| 17:41 | • Ticket [1036649fff]: 4 changes artifact: d45512f72f user: msofer | |
| 02:39 | • Ticket [1036649fff]: 4 changes artifact: cfe0ef4594 user: msofer | |
|
2004-09-29
| ||
| 19:07 | • Ticket [1036649fff]: 4 changes artifact: c880a6c3a8 user: dkf | |
| 17:57 | • Add attachment 1036649.patch to ticket [1036649fff] artifact: 469d07b534 user: msofer | |
| 17:57 | • Ticket [1036649fff] Buffer overrun in subst status still Open with 4 other... artifact: 34752525a9 user: msofer | |
| 17:36 | • Ticket [1036649fff]: 4 changes artifact: 5f69c0237a user: dkf | |
| 15:25 | • Ticket [1036649fff]: 2 changes artifact: 03d5b4035e user: dkf | |
| 09:14 | • Ticket [1036649fff]: 4 changes artifact: b7adc8c665 user: msofer | |
| 09:14 | • Ticket [1036649fff]: 4 changes artifact: 3ba1de616e user: msofer | |
|
2004-09-28
| ||
| 23:22 | • New ticket [1036649fff]. artifact: b445b6bcac user: dkf | |
Buffer overrun in [subst]
Closed / Fixed1036649fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-09-28 23:22:08
This is not a problem in the HEAD.
Repeatedly do this command. The error result is always
strange and occasionally it crashes. (Seems random which.)
subst {[set x 1;}
GDB claims crash happened like this:
Program received signal SIGSEGV, Segmentation fault.
0x0807e5ab in Tcl_SubstObj (interp=0x8103390,
objPtr=0x810bd10, flags=7)
at ../generic/tclCmdMZ.c:2578
2578 switch (*p) {
The 'p' pointer seems to have overflowed well past the
end of the objPtr->bytes parameter:
(gdb) print p
$1 = 0x812c000 <Address 0x812c000 out of bounds>
(gdb) print objPtr->bytes
$2 = 0x8127788 "[set x 1;"
Looks like a buffer overrun to me, and [subst] is often
exposed to external sources. => CRITICAL BUG
msoferplain2004-09-29 09:14:13
Logged In: YES user_id=148712 The problem seems to be in Tcl_EvalEx: it fails when it evaluates a nested script of unknown length (numBytes==-1) that is missing the closing ']' AND ends in ';' (a space after that seems not to trigger the buffer overflow). In any case, the attached patch to core-8-4-branch seems to fix it. There might be a more elegant to fix this ... Note that Tcl_EvalEx has been rewritten in HEAD; I did not yet check if the problemmight be there too.
msoferplain2004-09-29 09:14:14
File Added - 103128: 1036649.patch
dkf Ticket [1036649fff]: 2 changes
[History diff]2004-09-29 15:25:26
dkfplain2004-09-29 17:36:13
Logged In: YES
user_id=79902
Syntax error is reported wrongly. :^(
When I did the following after applying your patch:
subst "\[subst {};"
I got this error:
can't read "f": no such variable
msoferplain2004-09-29 17:57:34
File Deleted - 103128: File Added - 103169: 1036649.patch Logged In: YES user_id=148712 updated patch - still missing tests
dkfplain2004-09-29 19:07:00
Logged In: YES
user_id=79902
Fix looks good. Suggested test (you might want to give it a
different test number):
test subst-12.1 {nasty case} {
list [catch {subst "\[subst {};"} msg] $msg
} {1 {missing close-bracket}}
msoferplain2004-09-30 02:39:04
Logged In: YES user_id=148712 Fix and tests committed to core-8-4-branch. Still to do: commit the new tests to HEAD, check if HEAD has the flaw too.
msoferplain2004-09-30 17:41:35
Logged In: YES user_id=148712 tests added to HEAD; code review not yet done
dgpplain2004-10-27 03:54:48
Logged In: YES user_id=80530 added more tests (subst-12.3,4) to show the effect of syntax errors on side effects. Test subst-12.3 illustrates a change in behavior from 8.4 to 8.5.
dgpplain2004-10-27 04:58:09
Logged In: YES user_id=80530 corrected HEAD to have same subst-12.3 results as the 8.4 branch. At this point [subst] does not crash and is consistent between 8.4 and 8.5.. Anyone wanted other mods to [subst] should file a separate report.
dgp Ticket [1036649fff]: 1 change
[History diff]2004-10-27 05:01:46
Log in (anonymous is fine) to add a comment.
Attachments:
- 1036649.patch [download] added by msofer on 2004-09-29 17:57:34. [details]