Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 827abaf731595b8ae20fafa721e47845d44dbc9d
Ticket: 8f245009b0bde00454c3cecfef1d230596f78b51
Another case that hangs regexp optimizer pullback() phase
User & Date: tgl on 2013-09-25 13:04:16
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    This example hangs tclsh in versions I have handy to test:
    
    regexp {(^(?!aa))+} {aa bb cc}
    
    I believe this demonstrates that the response to CVE-2007-4772 (Tcl bug 1810038) was inadequate.
    We prevented a hang in cases where a state-to-be-pulled-past has a trivial circular constraint arc.  But in the above example, there is a loop of two states connected by constraint arcs, and the code gets into an infinite loop trying to push back the constraints indefinitely.  While I've not experimented to prove it, I think that loops of any number of states could be built by extending this example, so the quick-hack solution embodied in the previous fix can't readily be improved to handle this.
    
    One possible line of attack to fix this is to replace the previous check with a generic search to see if the current state is included in any circular chain of constraint arcs.  That might be expensive though.
    
    Another idea is to simply exclude any states created during pull() from subsequent processing in pullback(), which we could do by remembering the largest state number at entry to pullback() and ignoring states with higher numbers.
    
    A question for either of these approaches is whether the pullback processing is necessary for correctness (because it satisfies some execution-time assumption) or is just an optimization that can safely be skipped in some cases.  I think the latter but am not exactly sure.
    
    Thoughts?
    
  5. foundin changed to: "8.5.13"
  6. is_private changed to: "0"
  7. login: "tgl"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "26864b65f1c6ce8bda86f87ed9c554e19ac0390d"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "tgl"
  14. subsystem changed to: "43. Regexp"
  15. title changed to:
    Another case that hangs regexp optimizer pullback() phase
    
  16. type changed to: "Bug"