[pcre-dev] [Bug 2244] New: pcreposix REG_STARTEND support is…

Pàgina inicial
Delete this message
Autor: admin
Data:  
A: pcre-dev
Assumpte: [pcre-dev] [Bug 2244] New: pcreposix REG_STARTEND support is not quite right
https://bugs.exim.org/show_bug.cgi?id=2244

            Bug ID: 2244
           Summary: pcreposix REG_STARTEND support is not quite right
           Product: PCRE
           Version: 8.41
          Hardware: All
                OS: All
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
          Assignee: ph10@???
          Reporter: mackyle@???
                CC: pcre-dev@???


This issue was originally diagnosed in bug 2128 but there are still some issues
even with the fix that's been included in 8.41.

Given this code (some error checking omitted for clarity):

    regex_t re;
    regmatch_t rm[5];
    memset(&re, 0, sizeof(re));
    regcomp(&re, "((a)(b)?(c))", REG_EXTENDED);
    rm[0].rm_so = 2;
    rm[0].rm_eo = 6;
    regexec(&re, "123ace", 5, rm, REG_STARTEND);


Notice that REG_STARTEND has been used with a non-zero
starting offset of 2 and that the "(b)?" subpattern "$3"
does not match anything.

The rm_so, rm_eo results can be described thusly:

|       | correct      | PCRE 8.40    | PCRE 8.41    |
| ----- | ------------ | ------------ | ------------ |
| rm[0] | so=3,  eo=5  | so=1,  eo=3  | so=3,  eo=5  |
| rm[1] | so=3,  eo=5  | so=1,  eo=3  | so=3,  eo=5  |
| rm[2] | so=3,  eo=4  | so=1,  eo=2  | so=3,  eo=4  |
| rm[3] | so=-1, eo=-1 | so=-1, eo=-1 | so=1,  eo=1  |
| rm[4] | so=4,  eo=5  | so=2,  eo=3  | so=4,  eo=5  |


As you can see for the five cases, PCRE 8.40 got 1 out of 5 right, while PCRE
8.41 gets 4 out of 5 right.

There's the matter of the -1,-1 result for rm[3] that is now incorrect for PCRE
8.41.

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