Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3b0831add2ba3fc8f6dbb577081344fd2d1cc341
Ticket: 3565462fffffffffffffffffffffffffffffffff
Segmentation fault on linux 64 bit
User & Date: tobv on 2012-09-07 09:24:52
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Hi, 
    
    We believe we have found a bug in the code for 64 bit system. 
    
    Our code that causes it is: 
    int socketfd;
    if (Tcl_GetChannelHandle(channel, TCL_READABLE, (ClientData)&socketfd) != TCL_OK) {
    return TCL_ERROR;
    }
    
    The cause is in: 
    In Tcl_GetChannelHandle() (tclIO.c)
    
        ClientData handle;
        result = (chanPtr->typePtr->getHandleProc)(chanPtr->instanceData,
        direction, &handle);
        if (handlePtr) {
    *handlePtr = handle;
        }
    
    and
    tclUnixChan.c
    
    static int
    TcpGetHandleProc(
        ClientData instanceData,/* The socket state. */
        int direction,/* Not used. */
        ClientData *handlePtr)/* Where to store the handle. */
    {
        TcpState *statePtr = (TcpState *) instanceData;
    
        *handlePtr = (ClientData) INT2PTR(statePtr->fd);
        return TCL_OK;
    }
    
    where it in the end tries to set *handlePtr (pointer to an int) to a long value.
    
    And the solution should be: 
    
    Solution:
    
    In Tcl_GetChannelHandle() (tclIO.c)
    
        result = (chanPtr->typePtr->getHandleProc)(chanPtr->instanceData,
        direction, handlePtr);
    
    In TcpGetHandleProc (tclUnixChan.c)
    
    tclUnixChan.c
    
    static int
    TcpGetHandleProc(
        ClientData instanceData,/* The socket state. */
        int direction,/* Not used. */
        ClientData *handlePtr)/* Where to store the handle. */
    {
        TcpState *statePtr = (TcpState *) instanceData;
    
        if (handlePtr) {
    *handlePtr = statePtr->fd;
        }
        return TCL_OK;
    }
    
    System information: 
    System information: 
    % parray tcl_platform
    tcl_platform(byteOrder)   = littleEndian
    tcl_platform(machine)     = x86_64
    tcl_platform(os)          = Linux
    tcl_platform(osVersion)   = 2.6.32.29-0.3-default
    tcl_platform(platform)    = unix
    tcl_platform(pointerSize) = 8
    tcl_platform(user)        = xxxxx
    tcl_platform(wordSize)    = 8
    
  4. foundin changed to: "obsolete: 8.5.12"
  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: "tobv"
  10. subsystem changed to: "None"
  11. title changed to: "Segmentation fault on linux 64 bit "
  12. type changed to: "Bug"