|
2003-05-11
| ||
| 06:57 | • Ticket [714106ffff] string repeat may crash status still Closed with 4 oth... artifact: 1597a9cd8b user: hobbs | |
| 06:57 | • Add attachment 714106.strrepeat to ticket [714106ffff] artifact: 462e373f6f user: hobbs | |
| 06:57 | • Closed ticket [714106ffff]: string repeat may crash plus 7 other changes artifact: 3687e7bfe3 user: hobbs | |
|
2003-04-02
| ||
| 18:58 | • New ticket [714106ffff]. artifact: f7026638d7 user: nobody | |
[string repeat] may crash
Closed / Fixed714106ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-04-02 18:58:39
The following code crashes a 32-bit machine (PC):
set M [string repeat x 1048576]
set G4 [string repeat $M 4096]
The culprit is the unchecked length multiplication
in line 2110 in "generic/tclCmdMZ.c:
length2 = length1 * count;
That can overflow. As a result, much less memory
gets allocated, than filled after allocation.
I suggest to check the multiplication by back-division:
if ((length2 / count) != length1) { ...error... }
Heiner [email protected]
hobbsplain2003-05-11 06:57:38
Logged In: YES user_id=72656 Closed with the attached patch. I didn't add a test because it would have different behavior on 64-bit ILP systems. Fixed for 8.4.3 and 8.5.
hobbsplain2003-05-11 06:57:39
File Added - 50083: 714106.strrepeat
Log in (anonymous is fine) to add a comment.
Attachments:
- 714106.strrepeat [download] added by hobbs on 2003-05-11 06:57:38. [details]