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

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

[Octave-bug-tracker] [bug #51589] crash on regexp


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #51589] crash on regexp
Date: Thu, 27 Jul 2017 18:37:27 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #7, bug #51589 (project octave):

Stack overflow seems to fit the behavior.  Here is some info on the stack
usage:

http://pcre.org/original/doc/html/pcreapi.html#SEC22

http://pcre.org/original/doc/html/pcrestack.html

http://pcre.org/original/doc/html/pcretest.html

I don't see the pcretest utility on my system, so I can't test.  But I think
you are right, now that I read a little bit.  The stack recursion is described
in one of the above links.  They use a "match()" recursion so that it can back
out of where it was in some way.  Because of all the a's, I suspect the
recursion is going something like


a (now search for aa)
aa (now search for aaa)
aaa (now search for aaaa)
aaaa
aaaaa
aaaaaa
aaaaaaa


and so on.  I'm going to guess that match doesn't use much stack, but all it
takes is to push as much as a return address and eventually the stack will
overflow.

There is a comment in the documentation:

"
If PCRE has been compiled to use the heap instead of the stack for recursion,
the value returned is the size of each block that is obtained from the heap.
"

Unfortunately, as I think PCRE is a library, that heap option is out of our
control and instead done at the system level.

But, there may be an alternative function:

http://pcre.org/original/doc/html/pcrestack.html

pcre[16|32]_dfa_exec()

That might be the function we want, it only does recursion in limited
circumstances...  I'm about to leave for a few hours, perhaps you could
investigate.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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