Core dump in conditional ahead match and matching \! character

Create issue
Issue #217 resolved
Jean-Christophe Morin created an issue

Hi! I am facing a nice core dump while using your latest version with this regex:

My string that I am trying to match is more complex than in this example, but I found that ! character was creating the core dump.

[jcmorin@qc-wrk055l~python_libs] (dev_string_optional_formatter)$ python
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import regex
>>> pattern = regex.compile('(?(?=.*\!.*)(?P<true>.*\!\w*\:.*)|(?P<false>.*))', flags=regex.DEBUG)
CONDITIONAL AHEAD MATCH
  GREEDY_REPEAT 0 INF
    ANY
  CHARACTER MATCH '!'
  GREEDY_REPEAT 0 INF
    ANY
EITHER
  GROUP 1
    GREEDY_REPEAT 0 INF
      ANY
    CHARACTER MATCH '!'
    GREEDY_REPEAT 0 INF
      PROPERTY MATCH WORD:TRUE
    CHARACTER MATCH ':'
    GREEDY_REPEAT 0 INF
      ANY
%sOR
  GROUP 2
    GREEDY_REPEAT 0 INF
      ANY
>>> pattern.match('!')
Segmentation fault (core dumped)

Why is it crashing like this? I tried in pyhon 2.6.6 (64 bits) and 2.7.3 (64 Bits) on Linux and they both do a core dump.

Thanks for looking into this!

Comments (3)

  1. Jean-Christophe Morin reporter

    Hi @mrabarnett , is this version available via pip, or I need to download it from this repo?

  2. Log in to comment