Skip to content
Tcl Source Code History Of Ticket 1dab713a38
Login

History Of Ticket 1dab713a38

Artifacts Associated With Ticket 1dab713a38

  1. Ticket change [f067701563] (rid 190858) by tgl on 2021-01-08 18:10:46:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      brenext(), when parsing a '*' quantifier, forgets to return any "value"
      for the token; per the equivalent case in next(), it should return
      value 1 to indicate that greedy rather than non-greedy behavior is
      wanted.  The result is that the compiled regexp could behave like 'x*?'
      rather than the intended 'x*', if we are unlucky enough to have
      a zero in v->nextvalue at this point.  In Postgres it seems not too hard
      for that to happen when the regexp begins with, say, '.*'; and in any case
      valgrind complains about uninitialized-value usage.  I've had a much
      harder time reproducing it in Tcl, but one way that seems reliable is
      
      $ tclsh
      % regexp -inline {\u0000} {}
      % regexp -inline {(?b).*} {abc}
      {}
      
      Of course the correct answer is "abc", and that is what you get (usually)
      if you do nothing, or some other regexp, before the buggy one.
      
      The fix is a one-liner:
      
      --- generic/regc_lex.c~ 2019-08-28 08:46:06.000000000 -0400
      +++ generic/regc_lex.c  2021-01-08 12:57:11.056650507 -0500
      @@ -1005,7 +1005,7 @@ brenext(
              if (LASTTYPE(EMPTY) || LASTTYPE('(') || LASTTYPE('^')) {
                  RETV(PLAIN, c);
              }
      -       RET('*');
      +       RETV('*', 1);
              break;
           case CHR('['):
              if (HAVE(6) &&  *(v->now+0) == CHR('[') &&
      
    5. foundin initialized to: "8.6.10"
    6. is_private initialized to: "0"
    7. login: "tgl"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "26864b65f1c6ce8bda86f87ed9c554e19ac0390d"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "tgl"
    14. subsystem initialized to: "43. Regexp"
    15. title initialized to:
      Uninitialized-variable use while parsing '*' in BRE-mode regexps
      
    16. type initialized to: "Bug"
  2. Ticket change [0ff076b3c0] (rid 190980) by jan.nijtmans on 2021-01-11 11:56:44:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2459225.99774001"
    3. closer changed to: "jan.nijtmans"
    4. icomment:
      Yes, I can reproduce this. Thanks for the report and fix! Now merged to all active branches.
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"