Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f7026638d7ee7003dec362e9f42738494446786c
Ticket: 714106ffffffffffffffffffffffffffffffffff
[string repeat] may crash
User & Date: nobody on 2003-04-02 18:58:39
Changes

  1. assignee changed to: "hobbs"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    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]
    
  4. foundin changed to: "obsolete: 8.4.2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "41. Memory Allocation"
  10. title changed to: "[string repeat] may crash"
  11. type changed to: "Bug"