gnu: gd: Fix failing test on i686.
[jackhill/guix/guix.git] / gnu / packages / patches / pcre-CVE-2016-3191.patch
1 Fix for CVE-2016-3191.
2 See <https://bugzilla.redhat.com/show_bug.cgi?id=1311503>.
3 This is svn r1631 at <svn://vcs.exim.org/pcre/code>.
4
5 Index: trunk/testdata/testoutput11-16
6 ===================================================================
7 --- trunk/testdata/testoutput11-16 (revision 1630)
8 +++ trunk/testdata/testoutput11-16 (revision 1631)
9 @@ -765,4 +765,7 @@
10 25 End
11 ------------------------------------------------------------------
12
13 +/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
14 +Failed: regular expression is too complicated at offset 490
15 +
16 /-- End of testinput11 --/
17 Index: trunk/testdata/testinput11
18 ===================================================================
19 --- trunk/testdata/testinput11 (revision 1630)
20 +++ trunk/testdata/testinput11 (revision 1631)
21 @@ -138,4 +138,6 @@
22
23 /.((?2)(?R)\1)()/B
24
25 +/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
26 +
27 /-- End of testinput11 --/
28 Index: trunk/testdata/testoutput11-8
29 ===================================================================
30 --- trunk/testdata/testoutput11-8 (revision 1630)
31 +++ trunk/testdata/testoutput11-8 (revision 1631)
32 @@ -765,4 +765,7 @@
33 38 End
34 ------------------------------------------------------------------
35
36 +/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
37 +Failed: missing ) at offset 509
38 +
39 /-- End of testinput11 --/
40 Index: trunk/testdata/testoutput11-32
41 ===================================================================
42 --- trunk/testdata/testoutput11-32 (revision 1630)
43 +++ trunk/testdata/testoutput11-32 (revision 1631)
44 @@ -765,4 +765,7 @@
45 25 End
46 ------------------------------------------------------------------
47
48 +/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
49 +Failed: missing ) at offset 509
50 +
51 /-- End of testinput11 --/
52 Index: trunk/pcre_internal.h
53 ===================================================================
54 --- trunk/pcre_internal.h (revision 1630)
55 +++ trunk/pcre_internal.h (revision 1631)
56 @@ -7,7 +7,7 @@
57 and semantics are as close as possible to those of the Perl 5 language.
58
59 Written by Philip Hazel
60 - Copyright (c) 1997-2014 University of Cambridge
61 + Copyright (c) 1997-2016 University of Cambridge
62
63 -----------------------------------------------------------------------------
64 Redistribution and use in source and binary forms, with or without
65 @@ -2289,7 +2289,7 @@
66 ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59,
67 ERR60, ERR61, ERR62, ERR63, ERR64, ERR65, ERR66, ERR67, ERR68, ERR69,
68 ERR70, ERR71, ERR72, ERR73, ERR74, ERR75, ERR76, ERR77, ERR78, ERR79,
69 - ERR80, ERR81, ERR82, ERR83, ERR84, ERR85, ERR86, ERRCOUNT };
70 + ERR80, ERR81, ERR82, ERR83, ERR84, ERR85, ERR86, ERR87, ERRCOUNT };
71
72 /* JIT compiling modes. The function list is indexed by them. */
73
74 Index: trunk/pcre_compile.c
75 ===================================================================
76 --- trunk/pcre_compile.c (revision 1630)
77 +++ trunk/pcre_compile.c (revision 1631)
78 @@ -6,7 +6,7 @@
79 and semantics are as close as possible to those of the Perl 5 language.
80
81 Written by Philip Hazel
82 - Copyright (c) 1997-2014 University of Cambridge
83 + Copyright (c) 1997-2016 University of Cambridge
84
85 -----------------------------------------------------------------------------
86 Redistribution and use in source and binary forms, with or without
87 @@ -560,6 +560,7 @@
88 /* 85 */
89 "parentheses are too deeply nested (stack check)\0"
90 "digits missing in \\x{} or \\o{}\0"
91 + "regular expression is too complicated\0"
92 ;
93
94 /* Table to identify digits and hex digits. This is used when compiling
95 @@ -4591,7 +4592,8 @@
96 if (code > cd->start_workspace + cd->workspace_size -
97 WORK_SIZE_SAFETY_MARGIN) /* Check for overrun */
98 {
99 - *errorcodeptr = ERR52;
100 + *errorcodeptr = (code >= cd->start_workspace + cd->workspace_size)?
101 + ERR52 : ERR87;
102 goto FAILED;
103 }
104
105 @@ -6626,8 +6628,21 @@
106 cd->had_accept = TRUE;
107 for (oc = cd->open_caps; oc != NULL; oc = oc->next)
108 {
109 - *code++ = OP_CLOSE;
110 - PUT2INC(code, 0, oc->number);
111 + if (lengthptr != NULL)
112 + {
113 +#ifdef COMPILE_PCRE8
114 + *lengthptr += 1 + IMM2_SIZE;
115 +#elif defined COMPILE_PCRE16
116 + *lengthptr += 2 + IMM2_SIZE;
117 +#elif defined COMPILE_PCRE32
118 + *lengthptr += 4 + IMM2_SIZE;
119 +#endif
120 + }
121 + else
122 + {
123 + *code++ = OP_CLOSE;
124 + PUT2INC(code, 0, oc->number);
125 + }
126 }
127 setverb = *code++ =
128 (cd->assert_depth > 0)? OP_ASSERT_ACCEPT : OP_ACCEPT;
129 Index: trunk/pcreposix.c
130 ===================================================================
131 --- trunk/pcreposix.c (revision 1630)
132 +++ trunk/pcreposix.c (revision 1631)
133 @@ -6,7 +6,7 @@
134 and semantics are as close as possible to those of the Perl 5 language.
135
136 Written by Philip Hazel
137 - Copyright (c) 1997-2014 University of Cambridge
138 + Copyright (c) 1997-2016 University of Cambridge
139
140 -----------------------------------------------------------------------------
141 Redistribution and use in source and binary forms, with or without
142 @@ -173,7 +173,8 @@
143 REG_BADPAT, /* group name must start with a non-digit */
144 /* 85 */
145 REG_BADPAT, /* parentheses too deeply nested (stack check) */
146 - REG_BADPAT /* missing digits in \x{} or \o{} */
147 + REG_BADPAT, /* missing digits in \x{} or \o{} */
148 + REG_BADPAT /* pattern too complicated */
149 };
150
151 /* Table of texts corresponding to POSIX error codes */