Skip to content
Tcl Source Code History Of Ticket 1905562
Login

History Of Ticket 1905562

Artifacts Associated With Ticket 1905562

  1. Ticket change [90ab2f848b] (rid 120490) by kennykb on 2008-03-02 03:57:14:

    1. assignee initialized to: "pvgoran"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Running a self-built TCL from today's HEAD, I get a segmentation violation at reg-33.14.  The build was with
      msys and MSVC 2k5 with
      
      CC=cl path/to/win/configure --enable-symbols --enable-threads
      
      More details when I've got 'em.
      
    4. foundin initialized to: "obsolete: 8.5.2"
    5. is_private initialized to: "0"
    6. priority initialized to: "9 Immediate"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "kennykb"
    10. subsystem initialized to: "43. Regexp"
    11. title initialized to: "test reg-33.14 gets pointer smash"
    12. type initialized to: "Bug"
  2. Ticket change [bd1b6d6557] (rid 101855) by kennykb on 2008-03-02 11:23:07:

    1. icomment:
      Logged In: YES 
      user_id=99768
      Originator: YES
      
      The crash appears to be related to a stack overflow, heap corruption, or memory exhaustion in the duptraverse() function in regc_nfa.c.  Running without the MSVC debugger, there is a simple pointer smash.  Launching the executable under the debugger, and running from there, yields instead a call to Tcl_Panic with "unable to allocate 368 bytes" at line 1032.  The recursive nest of calls to duptraverse is beyond MSVC's ability to traverse.
      
      
    2. login: "kennykb"
    3. mimetype: "text/plain"
    4. username: "kennykb"
  3. Ticket change [cd73bc9ed5] (rid 95892) by dgp on 2008-03-12 02:09:00:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      any progress on this?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [4387665c47] (rid 116568) by cleverly on 2008-03-15 02:26:14:

    1. icomment:
      Logged In: YES 
      user_id=22080
      Originator: NO
      
      As a point of reference, with 8.5.2rc1 reg-33.14 also segfaults on OpenBSD 4.2 (sparc64) in a non-thread enabled build (gcc 3.3.5).
      
      
    2. login: "cleverly"
    3. mimetype: "text/plain"
    4. username: "cleverly"
  5. Ticket change [d4d072f294] (rid 123508) by dgp on 2008-03-19 00:27:18:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      Reproduced on sparc Solaris 9 with a
      --enable-symbols --enable-64bit configuration.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [386cd826c0] (rid 112207) by dgp on 2008-03-19 04:07:24:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      Going back a few releases...
      
      $ make runtest
      ...
      % info patch
      8.4.15
      % regexp {(x{200}){200}$y} x
      Segmentation Fault
      
      
      The test that triggers the crash
      is new.  The bugginess that permits
      the crash is apparently not.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  7. Ticket change [3864b67662] (rid 112201) by dgp on 2008-03-19 04:36:50:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      This is looking like C stack overflow.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  8. Ticket change [6661c56d32] (rid 102704) by dgp on 2008-03-19 04:57:29:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      On a platform where test reg-33.14
      does not crash, I see:
      
      % regexp {(x{222}){222}$y} x
      couldn't compile regular expression pattern: nfa has too many states
      
      So if things continue to get bigger,
      this error message appears to protect against
      the possibility of stack overflow everywhere.
      It's assumed there's enough stack to cover traversal
      of all nfa's with states below the limit.
      
      Points to a possible fix of imposing a smaller
      limit on these stack-limited platforms?
      
      Alternative would be a significant rewrite of
      the RE engine guts to not do so much recursive
      stuff.
      
      Shorter term, we can either drop the demands
      of test reg-33.14 to avoid confronting the issue
      in the test suite, or simply mark it as a
      nonportable test.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  9. Ticket change [ddd02423c2] (rid 114742) by dgp on 2008-03-19 04:57:30:

    1. assignee changed to: "kennykb"
  10. Ticket change [db5fddff9d] (rid 107954) by kennykb on 2008-03-19 19:51:53:

    1. assignee changed to: "dkf"
    2. icomment:
      Logged In: YES 
      user_id=99768
      Originator: YES
      
      Reassigning to someone who appears to have a clue what's going on.
      
      
    3. login: "kennykb"
    4. mimetype: "text/plain"
    5. username: "kennykb"
  11. Ticket change [7f16e39d9d] (rid 97516) by dkf on 2008-03-19 20:41:10:

    1. assignee changed to: "msofer"
    2. icomment:
      Logged In: YES 
      user_id=79902
      Originator: NO
      
      Suggested workaround: use a bigger stack. Meanwhile, I've marked the test nonPortable.
      
      Maybe the correct fix is to use stack protection voodoo like Tcl does/did. Assigning to Miguel for comment.
      
      
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. priority changed to: "8"
    6. resolution changed to: "Works For Me"
    7. username: "dkf"
  12. Ticket change [5812767c3a] (rid 117742) by dgp on 2008-03-19 21:07:40:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      Miguel's efforts at stack protection are
      appreciated, but they don't exactly have
      a flawless track record.
      
      A more certain "real fix" for this issue
      would be to follow the expr parser rewrite
      example and replace all these recursive
      routines with non-recursive versions.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  13. Ticket change [b0c4ff68cc] (rid 98034) by dgp on 2008-03-19 21:07:41:

    1. priority changed to: "5 Medium"
    2. resolution changed to: "Later"
  14. Ticket change [41d1ee9731] (rid 116255) by dkf on 2008-03-19 21:46:03:

    1. icomment:
      Logged In: YES 
      user_id=79902
      Originator: NO
      
      Hmm, it's doing tree-traversal and it needs to actions both before and after the recursive step. That's the case that's hard to convert.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  15. Ticket change [129eb355c5] (rid 124064) by msofer on 2008-06-28 20:38:02:

    1. assignee changed to: "dkf"
    2. icomment:
      Logged In: YES 
      user_id=148712
      Originator: NO
      
      C-stack protection against too-deep Tcl recursion? I'd rather get rid of it. And I will, during 8.6a? as part of NRE. 
      
      I imagine we could keep parts of it for regexps, but I agree with dgp (and jenglish, and many others): C-stack checking magic is a nasty hack, non-portable and half-working at best.
      
      
    3. login: "msofer"
    4. mimetype: "text/plain"
    5. username: "msofer"
  16. Ticket change [7acf6c9c16] (rid 90400) by dkf on 2008-07-01 21:31:11:

    1. closedate changed to: "2008-07-01T14:31:11"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      Originator: NO
      
      Added a focussed limit. duptraverse() can now only go 500 deep, and that seems to be enough for everything in the test suite that's normally run. Let me know if that's not enough (or too much).
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. status changed to: "Pending"
    7. username: "dkf"
  17. Ticket change [b428e2e392] (rid 124980) by sf-robot on 2008-07-16 09:20:19:

    1. closedate changed to: "2008-07-16T02:20:19"
    2. closer changed to: "sf-robot"
    3. icomment:
      Logged In: YES 
      user_id=1312539
      Originator: NO
      
      This Tracker item was closed automatically by the system. It was
      previously set to a Pending status, and the original submitter
      did not respond within 14 days (the time period specified by
      the administrator of this Tracker).
      
      
    4. login: "sf-robot"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "sf-robot"
  18. Ticket change [0da0e89ccc] (rid 114397) by dgp on 2013-02-07 00:52:58:

    1. icomment:
      See 3603557 for report from someone for whom
      that was not enough. :)
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  19. Ticket change [567ae43d80] (rid 94324) by dgp on 2013-04-01 23:20:48:

    1. icomment:
      Another person needing broader limits has reported
      to TCLCORE.  Re-opening so that a different solution
      can be considered.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. priority changed to: "8"
    5. resolution changed to: "None"
    6. status changed to: "Open"
    7. username: "dgp"
  20. Ticket change [b095d8ad07] (rid 133126) by dgp on 2013-08-01 17:19:51:

    1. closer changed to: "nobody"
    2. comment changed to:
      Running a self-built TCL from today's HEAD, I get a segmentation violation at reg-33.14.  The build was with
      msys and MSVC 2k5 with
      
      CC=cl path/to/win/configure --enable-symbols --enable-threads
      
      More details when I've got 'em.
      
    3. icomment:
      Ticket [8d2c0da36d] is a third report on this.
      Time to fix it.
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. priority changed to: "9 Immediate"
    7. severity changed to: "Minor"
  21. Ticket change [835befc0da] (rid 133128) by dgp on 2013-08-01 17:38:48:

    1. icomment:
      The current trunk already has the limit
      raise from 500 (in 8.6.0 release) to 700.
      
      As luck would have it, the new stress test
      derived from DejaGnu requires a value of 701,
      at least on my system.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  22. Ticket change [30e11dbfec] (rid 133129) by dgp on 2013-08-01 17:48:05:

    1. icomment:
      Another less simplified test:
      
      https://git.lysator.liu.se/lyskom-server/lyskom-server/blobs/raw/master/src/server/testsuite/dejagnu.0/01-long-regexp.exp
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  23. Ticket change [c69dbc9b88] (rid 133130) by dgp on 2013-08-01 17:50:58:

    1. icomment:
      Empirically, on my system, that one needs a limit of 817.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  24. Ticket change [b3df8b11cd] (rid 133131) by dgp on 2013-08-01 19:10:51:

    1. icomment:
      At the other end, on a Solaris 10 system where 
      I can produce the stack overflow crashes, I need
      a DUPTRAVERSE_MAX_DEPTH value of no more than 32639
      to provide protection.
      
      Pending further input from other platforms, I'd
      suggest a better compromise limit value to permit
      ridiculous regexps but still provide the stack
      overflow protection would be a value of 15000.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  25. Ticket change [c8148b8a3d] (rid 133135) by dgp on 2013-08-01 19:25:08:

    1. icomment:
      Committed that value to trunk, along
      with a test to keep the latest in-the-wild
      regexp working.
      
      Subject to further revision if we get even
      longer regexps reported, or if we find platforms
      where the new limit fails to protect against
      stack smashes.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. priority changed to: "5 Medium"
  26. Ticket change [233f1c28ad] (rid 133563) by dgp on 2013-08-30 17:04:51:

    1. icomment:
      See Ticket 267b7e2334 for another complaint
      on this subject (possibly out of date) but
      with a tangible suggestion how to implement
      a real solution rather than on ongoing tuning
      chase.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  27. Ticket change [787e6f198d] (rid 133743) by dkf on 2013-09-09 09:52:24:

    1. assignee changed to: "dgp"
    2. icomment:
      Assigning to someone who's more likely to work on this than me.
      
    3. login: "dkf"
    4. mimetype: "text/html"
    5. username: "dkf"
  28. Ticket change [22fe20aef0] (rid 257595) by serhiy.storchaka on 2026-10-11 10:09:04:

    1. foundin changed to: "8.6.18, 9.0.5, 9.1.0"
    2. icomment:
      The crash is gone since the <tt>DUPTRAVERSE_MAX_DEPTH</tt> limit, but the error is still the misleading "out of memory" (see also [267b7e2334]), and reg-33.14 is still marked nonPortable.
      
      Proposed fix in branch [/timeline?r=regexp-stack-depth|regexp-stack-depth] (for [7d47ba7d94]): the recursive functions now check the real stack depth, so such REs fail with "regular expression is too complex" on any stack size, and reg-33.14 is a normal test again.
      
    3. login: "serhiy.storchaka"
    4. mimetype: "text/x-fossil-wiki"