Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2009-03-20
21:36 • Closed ticket [2669109fff]: INST_CONCAT1 no overflow protection plus 7 other... artifact: 149f0510ea user: dgp
20:41 • Ticket [2669109fff]: 4 changes artifact: 314cf0af08 user: dgp
02:58 • Add attachment 2669109.patch to ticket [2669109fff] artifact: 7912a4c055 user: dgp
02:58 • Ticket [2669109fff] INST_CONCAT1 no overflow protection status still Open wi... artifact: 8c266e567a user: dgp
02:05 • Ticket [2669109fff]: 4 changes artifact: 5248691417 user: dgp
01:33 • Ticket [2669109fff]: 4 changes artifact: 4e77ec7220 user: dgp
01:28 • Ticket [2669109fff]: 4 changes artifact: 4cfe28a381 user: dgp
2009-03-08
04:15 • Ticket [2669109fff]: 4 changes artifact: 439690a868 user: ferrieux
2009-03-06
18:48 • New ticket [2669109fff]. artifact: b6b0d8a933 user: dgp

INST_CONCAT1 no overflow protection

Closed / Fixed2669109fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2009-03-06 18:48:16
appends that overflow the max
length of a string lead to
corrupted nonsense.
ferrieuxplain2009-03-08 04:15:26
It appears there is code duplication between INST_CONCAT1 and Tcl_AppendObjToObj.
Is there a good reason ?
Refactoring would solve this issue.
dgpplain2009-03-20 01:28:10
Demo:

% set foo [string repeat a 8421505]; concat
% set cmd {set bar }
set bar
% append cmd [string repeat {$foo} 255]; concat
% eval $cmd; concat
% string length $bar
-2147483521
dgpplain2009-03-20 01:33:20
Demo that doesn't need a system capable of
big allocations:

% set foo [string repeat a 16843010]; concat
% set cmd {set bar }
set bar
% append cmd [string repeat {$foo} 255]; concat
% eval $cmd; concat
make: *** [shell] Segmentation fault
dgpplain2009-03-20 02:05:01
Was going to turn those into
a test, but once the bug is
fixed, the proper behavior will
be to panic, which isn't test
friendly.
dgpplain2009-03-20 02:58:09
File Added - 318622: 2669109.patch


Here's a patch for the HEAD.
File Added: 2669109.patch
dgpplain2009-03-20 20:41:29
More reliable demo:

proc demo foo "set bar [string repeat {$foo} 255]"
demo [string repeat a 16843010]; concat
dgpplain2009-03-20 21:36:28
allow_comments - 1


fixed on all branches
Log in (anonymous is fine) to add a comment.

Attachments: