Tcl Source Code

Ticket Change Details
Login
Overview

Artifact ID: 1bd98c743c1f5d8e442bee8ecb3e6d87d2a30be0
Ticket: 272e866f1ec0af1927a7899a81b1c58395832096
Uncontrolled overflow in ReadBytes()
User & Date: gustafn 2013-11-12 19:05:42
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    When reading a file with e.g. 1.1 GB via
    
       set content [read $f]
    
    Tcl crashes due to the doubling policy of reallocs on machines where sizeof(int) == 32 (which is as well the case on 64 bit Linux). Due to doubling the length of the buffer, the length variable of type "int" becomes negative on values larger than 1GB. While one can discuss the usefulness of reading large files into memory, the situation can be improved quite easily by limiting the doubling policy to 2GB (actually INT_MAX).
    
    The problem happened in a Tcl-based zip-file generator, when the size of a single file is larger than 1.x GB. A sample patch is available (I assume i can attach the patch after writing the ticket). Most probably there are more places in Tcl, where a similar patch might be useful.
    
  5. foundin changed to: "8.5.15"
  6. is_private changed to: "0"
  7. login: "gustafn"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "d0ad4471e07e8c03bf0d90786ec6d31e33bcf241"
  10. resolution changed to: "None"
  11. severity changed to: "Severe"
  12. status changed to: "Open"
  13. submitter changed to: "gustafn"
  14. subsystem changed to: "25. Channel System"
  15. title changed to: "Crash when reading a file of e.g 1.1 GB"
  16. type changed to: "Bug"