[pcre-dev] [Bug 2283] New: RE::error() is nonempty even if …

Top Page
Delete this message
Author: admin
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 2283] New: RE::error() is nonempty even if compilation succeeds
https://bugs.exim.org/show_bug.cgi?id=2283

            Bug ID: 2283
           Summary: RE::error() is nonempty even if compilation succeeds
           Product: PCRE
           Version: 8.41
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
          Assignee: ph10@???
          Reporter: ksuarz@???
                CC: pcre-dev@???


Our project compiles pcrecpp::RE objects from user input and use them for regex
matching. We recently made a change where we now examine the error message:

    regex = new pcrecpp::RE(regex_str, flags_str);
    if (!regex->error().empty()) {
        throw ...;
    }


What's interesting is that Unicode-related start-only options trip an error in
verb parsing, yet the RE object returned is still usable for matching. These
are the options

- (*UCP)
- (*UTF)
- (*UTF8)
- etc.

Although RE::re_partial_ is populated, RE::error_ is also populated with
"(*VERB) not recognized or malformed". This is pretty misleading because the
header declaration for RE::error() states that "If RE could not be created
properly, returns an error string. Else, returns the empty string." It makes it
hard for our project to determine when to raise an error and when to continue
to use the regex.

Our project uses pcre-8.41, but after examining the source I think pcre-8.42 is
affected by this as well.

--
You are receiving this mail because:
You are on the CC list for the bug.