Skip to content
Tcl Source Code History Of Ticket 3127687fffffffff
Login

History Of Ticket 3127687fffffffff

Artifacts Associated With Ticket 3127687fffffffff

  1. Ticket change [66ab1f4d81] (rid 102754) by lool on 2010-12-04 23:54:57:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Hi there
      
      This affects tcl8.4 only, not tcl8.5.
      
      After a rebuild of tcl8.4 in Ubuntu, gitk and other applications were failing to start (even wish8.4 wouldn't start); these would fail with:
      *** buffer overflow detected ***: wish terminated
      followed by a backtrace.
      
      This is due to the _FORTIFY_SOURCE security feature, see:
      https://wiki.ubuntu.com/CompilerFlags#-D_FORTIFY_SOURCE=2
      https://wiki.ubuntu.com/Security/Features#Built%20with%20Fortify%20Source
      
      The original bug has details on why this occurs and is at:
      https://bugs.launchpad.net/ubuntu/+source/tcl8.4/+bug/683546
      
      As a workaround, I've changed the package to build generic/tclCmdMZ.c with -U_FORTIFY_SOURCE, but ideally the structure would declare the command[] with some define for the maximum length of variable names or commands.
      
      Cheers,
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "lool"
    10. subsystem initialized to: "18. Commands M-Z"
    11. title initialized to: "Triggers FORTIFY_SOURCE buffer overflow detection"
    12. type initialized to: "Bug"
  2. Add attachment "fortify-source.diff" [e2bbcd1999] (rid 87681) by lool on 2010-12-05 06:54:57.

  3. Ticket change [99207b4ff0] (rid 110732) by lool on 2010-12-05 06:54:57:

    1. icomment:
      
      
      File Added - 395235: fortify-source.diff
      
      
      
    2. login: "lool"
    3. mimetype: "text/plain"
    4. username: "lool"
  4. Ticket change [c6a29bd496] (rid 121803) by nijtmans on 2010-12-05 15:34:51:

    1. icomment:
      >ideally the structure would declare the command[] with some define for the maximum length of variable names or commands.
      
      Tcl does not have a maximum length of variable names or commands, other than the amount of availalble memory...
      
      For Tcl 8.6, a solution would be to define buffer having size [0],
      that's the standard way of doing this. But I don't know if all the
      supported compilers handle that. So for Tcl 8.4/8.5
      maybe the best is compile everything with
      -U_FORTIFY_SOURCE (Tcl8.5 this code moved to tclTrace.c).
      
      just my 2c
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  5. Ticket change [90169d4ee9] (rid 120385) by lool on 2010-12-05 18:41:09:

    1. icomment:
      Oddly, I don't hit the problem with wish8.5.  Maybe a different code path?
      
      I had tried changing command[4] to command[0], but that didn't work (it would still hit FORTIFY_SOURCE protection with a max size of zero).  However Kees Cook wrote to me that command[1] is how this should be defined.
      
      8.5 > As long as you don't hit FORTIFY_SOURCE protection, I guess it's best to keep it enabled, but if you do hit it then it would be nice to only disable it in the places where it's a false positive (rather than globally).
      
      Another way to avoid the issue entirely is to have a char *command and runtime allocate it, but that might have a performance hit.
      
      
    2. login: "lool"
    3. mimetype: "text/plain"
    4. username: "lool"
  6. Ticket change [e6c49c501c] (rid 104347) by nijtmans on 2010-12-06 05:14:59:

    1. icomment:
      changing command[4] to command[1] has the
      problem that the structure will be over-allocated
      (sizeof might add passing characters.....)
      
      better: replace the strcpy with memcpy, as we
      already know the length anyway. This is faster
      and should not trigger the FORTIFY_SOURCE.
      
      patch attached. Does this help?
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  7. Ticket change [12a0e1b58a] (rid 124070) by nijtmans on 2010-12-06 05:15:35:

    1. assignee changed to: "nijtmans"
  8. Ticket change [419b341066] (rid 116222) by nijtmans on 2010-12-06 05:16:09:

    1. icomment:
      
      
      File Added - 395305: 3127687.patch
      
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  9. Add attachment "3127687.patch" [d4948c88da] (rid 123472) by nijtmans on 2010-12-06 05:16:09.

  10. Ticket change [5872f66e2b] (rid 117804) by dkf on 2010-12-06 05:27:34:

    1. icomment:
      FWIW, I've been converting Tcl to use memcpy instead of strcpy whenever we know the length anyway (on the grounds that it might also be faster) but I don't think I've done any of that back in 8.4 (and I can't remember for 8.5...)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  11. Ticket change [e37be9060b] (rid 87809) by nijtmans on 2010-12-06 05:28:11:

    1. closedate changed to: "2010-12-05T22:28:11"
    2. closer changed to: "nijtmans"
    3. icomment:
      
      
      allow_comments - 1
      
      This is a dup of #3048354, which was never
      backported to 8.4. Fix is the same.
      
      Fixed on 8.4 branch.
      
      
    4. login: "nijtmans"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "nijtmans"