Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 34055ed8dedc7b8d9f79ab6b5b607d06bf2c1f95
Ticket: 1122671fffffffffffffffffffffffffffffffff
SEGV in Tcl_UtfToUniChar with unaligned string
User & Date: jtbrubaker on 2005-02-15 05:19:07
Changes

  1. icomment:
    Logged In: YES 
    user_id=1219284
    
    While difficult to reproduce, this does not mean that the
    bug should be shelved.
    
    In order to reproduce reliably, your stack must allocate
    FontMapLoadPage's buf array starting on an odd byte, on a
    platform that cares about byte alignment.  I cannot provide
    a testcase that does this for you since it depends on too
    many factors.
    
    From the debugger, it is clear that in my session, buf ended
    up on an odd byte (0xffffffff7fff3ab1).  Since
    Tcl_UtfToUniChar() thinks it's looking at an array of 2-byte
    elements, dereferencing any element within this array will
    cause a bus error (sorry, I think I said SEGV earlier).
    
    I plan on resolving this locally by using a temporary
    Tcl_UniChar variable and memcpying it back to the 'chPtr'
    pointer.  It would also be sufficient to change 'char
    buf[16]' in FontMapLoadPage to a Tcl_UniChar array, which
    will always be aligned properly.
    
    Jeff
    
    
    
  2. login: "jtbrubaker"
  3. mimetype: "text/plain"
  4. username: "jtbrubaker"