Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3a88712452e4ae20b730b66af934803a8753c1c2
Ticket: 2107634fffffffffffffffffffffffffffffffff
extend maximum command length to maxint
User & Date: brlcad on 2008-09-12 15:20:03
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    We ran into a problem in BRL-CAD with the maximum command length in Tcl and have a fix that extends the maximum command limit approximately two times where it presently fails.  The provided patch pushes that limit up about 2x by checking for the overflow and clamping to maxint.  If that maxint limit is exceeded, then it now returns -1 instead of crashing too.
    
    The current behavior without the patch is that 'length' ends up overflowing causing a crash inside Tcl_SetObjLength() where it tries to use length (which is negative maxint) as an array index.
    
    For those wondering just how we'd actually blow out that limit, our (.asc) ASCII file format in BRL-CAD is essentially a Tcl transcript.  So to load a file, we just have Tcl parse the file.  Being a CAD package, our files are geometry.  One of the geometry types is a polygonal mesh... So when you have one mesh that is really big (which is really easy to do), you end up blowing out the command length.
    
    This fix should be credited to Bob Parker (BRL-CAD developer) if it is applied.  The patch was made against 8.5.1
    
    We fully admit that the patch isn't ideal, but it does resolve the problem from our standpoint without any negative consequences until the API can be improved.  As you're undoubtedly well-aware, DoReadChars() and friends need to not use int everywhere for string/buffer length tracking, instead using size_t's or something similarly longer (and fixed) instead of int.
    
    Cheers!
    Sean
    
    
    
  4. foundin changed to: "None"
  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: "brlcad"
  10. subsystem changed to: "45. Parsing and Eval"
  11. title changed to: "extend maximum command length to maxint"
  12. type changed to: "Patch"