chiark / gitweb /
pcre3 (2:8.38-3.1) unstable; urgency=medium
[pcre3.git] / debian / patches / 794589-information-disclosure.patch
1 Description: pcre_exec does not fill offsets for certain regexps
2 Origin: upstream, http://vcs.pcre.org/pcre/code/trunk/pcre_exec.c?r1=1502&r2=1510
3 Bug: https://bugs.exim.org/show_bug.cgi?id=1537
4 Bug-Debian: https://bugs.debian.org/794589
5 Forwarded: not-needed
6 Last-Update: 2015-09-10
7 Applied-Upstream: 8.37
8
9 --- a/pcre_exec.c
10 +++ b/pcre_exec.c
11 @@ -1467,7 +1467,18 @@ for (;;)
12        md->offset_vector[offset] =
13          md->offset_vector[md->offset_end - number];
14        md->offset_vector[offset+1] = (int)(eptr - md->start_subject);
15 -      if (offset_top <= offset) offset_top = offset + 2;
16 +
17 +      /* If this group is at or above the current highwater mark, ensure that
18 +      any groups between the current high water mark and this group are marked
19 +      unset and then update the high water mark. */
20 +
21 +      if (offset >= offset_top)
22 +        {
23 +        register int *iptr = md->offset_vector + offset_top;
24 +        register int *iend = md->offset_vector + offset;
25 +        while (iptr < iend) *iptr++ = -1;
26 +        offset_top = offset + 2;
27 +        }
28        }
29      ecode += 1 + IMM2_SIZE;
30      break;