summaryrefslogtreecommitdiff
path: root/src/pcre2_substring.c
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2014-10-31 12:34:34 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2014-10-31 12:34:34 +0000
commitd3882ead437dfbb19d4c820969bdf3e3b295e4aa (patch)
treea443cac581d4bc2937460040039e59fdd7cb2975 /src/pcre2_substring.c
parent3c72e5dc813861511562b11663765a66953f2ce5 (diff)
downloadpcre2-d3882ead437dfbb19d4c820969bdf3e3b295e4aa.tar.gz
Improve test coverage; minor typo in JIT test and other minor buglets fixed.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@128 6239d852-aaf2-0410-a92c-79f79f948069
Diffstat (limited to 'src/pcre2_substring.c')
-rw-r--r--src/pcre2_substring.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pcre2_substring.c b/src/pcre2_substring.c
index 0b42d30..3faecd0 100644
--- a/src/pcre2_substring.c
+++ b/src/pcre2_substring.c
@@ -409,7 +409,8 @@ Arguments:
firstptr where to put the pointer to the first entry
lastptr where to put the pointer to the last entry
-Returns: if firstptr and lastptr are NULL, a group number;
+Returns: if firstptr and lastptr are NULL, a group number for a
+ unique substring, or PCRE2_ERROR_NOUNIQUESUBSTRING
otherwise, the length of each entry, or a negative number
(PCRE2_ERROR_NOSUBSTRING) if not found
*/
@@ -433,7 +434,6 @@ while (top > bot)
PCRE2_SPTR first;
PCRE2_SPTR last;
PCRE2_SPTR lastentry;
- if (firstptr == NULL) return GET2(entry, 0);
lastentry = nametable + entrysize * (code->name_count - 1);
first = last = entry;
while (first > nametable)
@@ -446,6 +446,8 @@ while (top > bot)
if (PRIV(strcmp)(stringname, (last + entrysize + IMM2_SIZE)) != 0) break;
last += entrysize;
}
+ if (firstptr == NULL)
+ return (first == last)? (int)GET2(entry, 0) : PCRE2_ERROR_NOUNIQUESUBSTRING;
*firstptr = first;
*lastptr = last;
return entrysize;