]>
Commit | Line | Data |
---|---|---|
b283b2cf AF |
1 | diff --git a/minilzo/minilzo.c b/minilzo/minilzo.c |
2 | index 34ce0f0..ecfdf66 100644 | |
3 | --- a/minilzo/minilzo.c | |
4 | +++ b/minilzo/minilzo.c | |
5 | @@ -3547,6 +3547,8 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, | |
6 | #undef TEST_LBO | |
7 | #undef NEED_IP | |
8 | #undef NEED_OP | |
9 | +#undef TEST_IV | |
10 | +#undef TEST_OV | |
11 | #undef HAVE_TEST_IP | |
12 | #undef HAVE_TEST_OP | |
13 | #undef HAVE_NEED_IP | |
14 | @@ -3561,6 +3563,7 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, | |
15 | # if (LZO_TEST_OVERRUN_INPUT >= 2) | |
16 | # define NEED_IP(x) \ | |
17 | if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun | |
18 | +# define TEST_IV(x) if ((x) > (lzo_uint)0 - (511)) goto input_overrun | |
19 | # endif | |
20 | #endif | |
21 | ||
22 | @@ -3572,6 +3575,7 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, | |
23 | # undef TEST_OP | |
24 | # define NEED_OP(x) \ | |
25 | if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun | |
26 | +# define TEST_OV(x) if ((x) > (lzo_uint)0 - (511)) goto output_overrun | |
27 | # endif | |
28 | #endif | |
29 | ||
30 | @@ -3602,11 +3606,13 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, | |
31 | # define HAVE_NEED_IP 1 | |
32 | #else | |
33 | # define NEED_IP(x) ((void) 0) | |
34 | +# define TEST_IV(x) ((void) 0) | |
35 | #endif | |
36 | #if defined(NEED_OP) | |
37 | # define HAVE_NEED_OP 1 | |
38 | #else | |
39 | # define NEED_OP(x) ((void) 0) | |
40 | +# define TEST_OV(x) ((void) 0) | |
41 | #endif | |
42 | ||
43 | #if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) | |
44 | @@ -3687,6 +3693,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, | |
45 | { | |
46 | t += 255; | |
47 | ip++; | |
48 | + TEST_IV(t); | |
49 | NEED_IP(1); | |
50 | } | |
51 | t += 15 + *ip++; | |
52 | @@ -3835,6 +3842,7 @@ match: | |
53 | { | |
54 | t += 255; | |
55 | ip++; | |
56 | + TEST_OV(t); | |
57 | NEED_IP(1); | |
58 | } | |
59 | t += 31 + *ip++; | |
60 | @@ -3879,6 +3887,7 @@ match: | |
61 | { | |
62 | t += 255; | |
63 | ip++; | |
64 | + TEST_OV(t); | |
65 | NEED_IP(1); | |
66 | } | |
67 | t += 7 + *ip++; | |
68 | @@ -4073,6 +4082,8 @@ lookbehind_overrun: | |
69 | #undef TEST_LBO | |
70 | #undef NEED_IP | |
71 | #undef NEED_OP | |
72 | +#undef TEST_IV | |
73 | +#undef TEST_OV | |
74 | #undef HAVE_TEST_IP | |
75 | #undef HAVE_TEST_OP | |
76 | #undef HAVE_NEED_IP | |
77 | @@ -4087,6 +4098,7 @@ lookbehind_overrun: | |
78 | # if (LZO_TEST_OVERRUN_INPUT >= 2) | |
79 | # define NEED_IP(x) \ | |
80 | if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun | |
81 | +# define TEST_IV(x) if ((x) > (lzo_uint)0 - (511)) goto input_overrun | |
82 | # endif | |
83 | #endif | |
84 | ||
85 | @@ -4098,6 +4110,7 @@ lookbehind_overrun: | |
86 | # undef TEST_OP | |
87 | # define NEED_OP(x) \ | |
88 | if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun | |
89 | +# define TEST_OV(x) if ((x) > (lzo_uint)0 - (511)) goto output_overrun | |
90 | # endif | |
91 | #endif | |
92 | ||
93 | @@ -4128,11 +4141,13 @@ lookbehind_overrun: | |
94 | # define HAVE_NEED_IP 1 | |
95 | #else | |
96 | # define NEED_IP(x) ((void) 0) | |
97 | +# define TEST_IV(x) ((void) 0) | |
98 | #endif | |
99 | #if defined(NEED_OP) | |
100 | # define HAVE_NEED_OP 1 | |
101 | #else | |
102 | # define NEED_OP(x) ((void) 0) | |
103 | +# define TEST_OV(x) ((void) 0) | |
104 | #endif | |
105 | ||
106 | #if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) | |
107 | @@ -4213,6 +4228,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, | |
108 | { | |
109 | t += 255; | |
110 | ip++; | |
111 | + TEST_IV(t); | |
112 | NEED_IP(1); | |
113 | } | |
114 | t += 15 + *ip++; | |
115 | @@ -4361,6 +4377,7 @@ match: | |
116 | { | |
117 | t += 255; | |
118 | ip++; | |
119 | + TEST_OV(t); | |
120 | NEED_IP(1); | |
121 | } | |
122 | t += 31 + *ip++; | |
123 | @@ -4405,6 +4422,7 @@ match: | |
124 | { | |
125 | t += 255; | |
126 | ip++; | |
127 | + TEST_OV(t); | |
128 | NEED_IP(1); | |
129 | } | |
130 | t += 7 + *ip++; | |
131 | diff --git a/src/lzo1_d.ch b/src/lzo1_d.ch | |
132 | index 40a5bfd..c442d9c 100644 | |
133 | --- a/src/lzo1_d.ch | |
134 | +++ b/src/lzo1_d.ch | |
135 | @@ -76,6 +76,8 @@ | |
136 | #undef TEST_LBO | |
137 | #undef NEED_IP | |
138 | #undef NEED_OP | |
139 | +#undef TEST_IV | |
140 | +#undef TEST_OV | |
141 | #undef HAVE_TEST_IP | |
142 | #undef HAVE_TEST_OP | |
143 | #undef HAVE_NEED_IP | |
144 | @@ -91,6 +93,7 @@ | |
145 | # if (LZO_TEST_OVERRUN_INPUT >= 2) | |
146 | # define NEED_IP(x) \ | |
147 | if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun | |
148 | +# define TEST_IV(x) if ((x) > (lzo_uint)0 - (511)) goto input_overrun | |
149 | # endif | |
150 | #endif | |
151 | ||
152 | @@ -102,6 +105,7 @@ | |
153 | # undef TEST_OP /* don't need both of the tests here */ | |
154 | # define NEED_OP(x) \ | |
155 | if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun | |
156 | +# define TEST_OV(x) if ((x) > (lzo_uint)0 - (511)) goto output_overrun | |
157 | # endif | |
158 | #endif | |
159 | ||
160 | @@ -135,11 +139,13 @@ | |
161 | # define HAVE_NEED_IP 1 | |
162 | #else | |
163 | # define NEED_IP(x) ((void) 0) | |
164 | +# define TEST_IV(x) ((void) 0) | |
165 | #endif | |
166 | #if defined(NEED_OP) | |
167 | # define HAVE_NEED_OP 1 | |
168 | #else | |
169 | # define NEED_OP(x) ((void) 0) | |
170 | +# define TEST_OV(x) ((void) 0) | |
171 | #endif | |
172 | ||
173 | ||
174 | diff --git a/src/lzo1b_d.ch b/src/lzo1b_d.ch | |
175 | index fe5f361..36b4b6b 100644 | |
176 | --- a/src/lzo1b_d.ch | |
177 | +++ b/src/lzo1b_d.ch | |
178 | @@ -187,6 +187,7 @@ match: | |
179 | { | |
180 | t += 255; | |
181 | ip++; | |
182 | + TEST_OV(t); | |
183 | NEED_IP(1); | |
184 | } | |
185 | t += (M4_MIN_LEN - M3_MIN_LEN) + *ip++; | |
186 | diff --git a/src/lzo1f_d.ch b/src/lzo1f_d.ch | |
187 | index 9e942f5..0c2199e 100644 | |
188 | --- a/src/lzo1f_d.ch | |
189 | +++ b/src/lzo1f_d.ch | |
190 | @@ -84,6 +84,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, | |
191 | { | |
192 | t += 255; | |
193 | ip++; | |
194 | + TEST_IV(t); | |
195 | NEED_IP(1); | |
196 | } | |
197 | t += 31 + *ip++; | |
198 | @@ -138,6 +139,7 @@ match: | |
199 | { | |
200 | t += 255; | |
201 | ip++; | |
202 | + TEST_OV(t); | |
203 | NEED_IP(1); | |
204 | } | |
205 | t += 31 + *ip++; | |
206 | diff --git a/src/lzo1x_d.ch b/src/lzo1x_d.ch | |
207 | index 49cf326..c804cc7 100644 | |
208 | --- a/src/lzo1x_d.ch | |
209 | +++ b/src/lzo1x_d.ch | |
210 | @@ -120,6 +120,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, | |
211 | { | |
212 | t += 255; | |
213 | ip++; | |
214 | + TEST_IV(t); | |
215 | NEED_IP(1); | |
216 | } | |
217 | t += 15 + *ip++; | |
218 | @@ -273,6 +274,7 @@ match: | |
219 | { | |
220 | t += 255; | |
221 | ip++; | |
222 | + TEST_OV(t); | |
223 | NEED_IP(1); | |
224 | } | |
225 | t += 31 + *ip++; | |
226 | @@ -317,6 +319,7 @@ match: | |
227 | { | |
228 | t += 255; | |
229 | ip++; | |
230 | + TEST_OV(t); | |
231 | NEED_IP(1); | |
232 | } | |
233 | t += 7 + *ip++; | |
234 | diff --git a/src/lzo2a_d.ch b/src/lzo2a_d.ch | |
235 | index 48e51ca..954f07e 100644 | |
236 | --- a/src/lzo2a_d.ch | |
237 | +++ b/src/lzo2a_d.ch | |
238 | @@ -131,6 +131,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, | |
239 | { | |
240 | t += 255; | |
241 | ip++; | |
242 | + TEST_OV(t); | |
243 | NEED_IP(1); | |
244 | } | |
245 | t += *ip++; |