Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2749dce1ba0fbd338b8e782a3dd7f8da6fd81ff2
Ticket: 3484402fffffffffffffffffffffffffffffffff
off-by-one address error in AppendUnicodeToUnicodeRep
User & Date: pooryorick on 2012-02-04 18:04:55
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    [append var1 $var2], data-corruption, e.g., random bytes from memory, show up in $var1
    
    problem traced to checkin f0785bb73d1ccd8a524b32c53d457c63b6bb912f, changes to AppendUnicodeToUnicodeRep, 
    
            if (unicode >= stringPtr->unicode && unicode <= stringPtr->unicode
                    + 1 + stringPtr->uallocated / sizeof(Tcl_UniChar)) {
                offset = unicode - stringPtr->unicode;
            }
    
    the "+1" seems to cause a comparison with the pointer immediately subsequent to
    the boundaries of stringPtr, and causing the 'unicode' to point to the wrong
    location after the ensuing realloc and offset manipulations.  Removing resulted
    the bug disappearing:
    
            if (unicode >= stringPtr->unicode && unicode <= stringPtr->unicode
                    + stringPtr->uallocated / sizeof(Tcl_UniChar)) {
                offset = unicode - stringPtr->unicode;
            }
    
    in order for the bug to be triggered, things have to fall just-so in memory, such
    that "unicode" is at the next address up from stringPtr.
    
    
  4. foundin changed to: "obsolete: 8.5.11"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "pooryorick"
  10. subsystem changed to: "69. Other"
  11. title changed to:
    off-by-one address error in AppendUnicodeToUnicodeRep
    
  12. type changed to: "Bug"