| Ticket UUID: | 2669109 | ||
| Title: | INST_CONCAT1 no overflow protection | ||
| Type: | Bug | Created on: | 2009-03-06 18:48:16 |
| Submitter: | dgp | Assigned to: | dgp |
| Subsystem: | 47. Bytecode Compiler | Severity: | |
| Priority: | 5 Medium | Last modified: | 2009-03-20 21:36:28 |
| Status: | Closed | Closed by: | dgp |
| Resolution: | Fixed | Closed on: | 2009-03-20 14:36:28 |
| Version: | obsolete: 8.6b1.1 | ||
| Description: | ||||
appends that overflow the max length of a string lead to corrupted nonsense. | ||||
| User Comments: | ||||
ferrieux added on 2009-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. dgp added on 2009-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
dgp added on 2009-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
dgp added on 2009-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. dgp added on 2009-03-20 02:58:09:
File Added - 318622: 2669109.patch Here's a patch for the HEAD. File Added: 2669109.patch dgp added on 2009-03-20 20:41:29:
More reliable demo:
proc demo foo "set bar [string repeat {$foo} 255]"
demo [string repeat a 16843010]; concat
dgp added on 2009-03-20 21:36:28:
allow_comments - 1 fixed on all branches | ||||
Attachments:
- 2669109.patch [download] added by dgp on 2009-03-20 02:58:09. [details]
