octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #29438] regexp: Crash with named subexpression


From: David Bateman
Subject: [Octave-bug-tracker] [bug #29438] regexp: Crash with named subexpressions and nested parentheses
Date: Fri, 09 Apr 2010 23:33:13 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.14) Gecko/2009091010 Iceweasel/3.0.14 (Debian-3.0.14-1)

Update of bug #29438 (project octave):

                  Status:               Confirmed => Fixed                  
             Assigned to:                    None => dbateman               

    _______________________________________________________

Follow-up Comment #2:

Its not a matter of failing to initialize a variable, but rather as the
original poster pointed out using the grouping operator in the pattern for a
named token cases an issue. The reason is that pcre_exec returns a value with
the number of matches it finds, but this return value is abused to pass
zero-length matches for the parentheses. These zero length matches weren't
correctly ignored for named tokens resulting in octave looking for the second
named token in an internal array when only one was defined and thus a
segfault.

Prove is that although

s = regexp('qwe int asd', ['(?<typestr>(int))'], 'names'); 

segfaults

s = regexp('qwe int asd', ['(?<typestr>int)'], 'names'); 

doesn't. Trivial changeset attached that I have pushed


(file #20177)
    _______________________________________________________

Additional Item Attachment:

File name: patch.regexp                   Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29438>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]