Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: dbf1a38a7aeae323320d3d92e2d66e7fde53067d
Ticket: 217898ffffffffffffffffffffffffffffffffff
tclScan.c should not blindly call ckalloc() for zero bytes o
User & Date: nobody on 2000-10-26 00:45:35
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 2518 Bug
    Version: 8.2b2
    SubmitDate: '1999-08-10'
    LastModified: '1999-09-17'
    Severity: MED
    Status: Closed
    Submitter: techsupp
    ChangedBy: hobbs
    RelatedBugIDs: 2795
    OS: AIX
    OSVersion: 4.3.2
    Machine: RS6000
    FixedDate: '2000-10-25'
    ClosedDate: '1999-09-17'
    
    
    Name:
    Valdis Kletnieks
    
    CVS:
    updated from CVS 08/10/99 * RCS: @(#) $Id: tclScan.c,v 1.2 1999/04/16 00:46:53 stanton Exp $
    
    Comments:
    The attached patch works around the problem at the cost of a small
        amount
        of temporarily allocated memory.  I wasn't ambitious enough to examine
        tclScan.c
        in more detail to see if there should be explicit tests/returns if
        numVars
        was a broken value.
    
    ReproducibleScript:
    On AIX 4.3.2, 'make test' fails fatally in 'scan.test' with an error
        unable to allocate zero bytes.
    
    DesiredBehavior:
    tclScan.c should not blindly call ckalloc() for zero bytes, which can
        happen
        if ValidateFormat() or Tcl_ScanObjCmd() is called with an incorrect objv
        list
        (which is intentionally tested in scan.test, and could also be tripped
        over
        by buggy user code, which should trigger a tcl_error, not crash Tcl
        entirely.
    
    Patch:
    http://black-ice.cc.vt.edu/~valdis/tcl8.2.tclScan.patch
    
    PatchFiles:
    tclScan.c
    
    
    
    This appears to be just an AIX problem.  Duffin says that the
    alloc of 0 bytes is undefined (although it shouldn't crash).
    He also states:
    
    Looking at the code in ValidateFormat in tclScan.c I noticed that you
    are not trying to use a local fixed size array as is normally done to
    try and reduce the number of allocations so that is probably the
    problem. Doing something like
    
    if (numVars > LOCAL_SIZE) {
    nassign = ckalloc (...)
    } else {
    nassign = localArray;
    }
    
    and the necessary clean up will probably fix it and fit in better with
    the way that it is normally done.
     
    -- 08/11/1999 hobbs
    
  4. foundin changed to: "obsolete: 8.2b2"
  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: "69. Other"
  10. title changed to:
    tclScan.c should not blindly call ckalloc() for zero bytes o
    
  11. type changed to: "Bug"