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,
14 @@ -3561,6 +3563,7 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len,
15 # if (LZO_TEST_OVERRUN_INPUT >= 2)
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
22 @@ -3572,6 +3575,7 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len,
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
30 @@ -3602,11 +3606,13 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len,
31 # define HAVE_NEED_IP 1
33 # define NEED_IP(x) ((void) 0)
34 +# define TEST_IV(x) ((void) 0)
37 # define HAVE_NEED_OP 1
39 # define NEED_OP(x) ((void) 0)
40 +# define TEST_OV(x) ((void) 0)
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,
52 @@ -3835,6 +3842,7 @@ match:
60 @@ -3879,6 +3887,7 @@ match:
68 @@ -4073,6 +4082,8 @@ lookbehind_overrun:
77 @@ -4087,6 +4098,7 @@ lookbehind_overrun:
78 # if (LZO_TEST_OVERRUN_INPUT >= 2)
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
85 @@ -4098,6 +4110,7 @@ lookbehind_overrun:
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
93 @@ -4128,11 +4141,13 @@ lookbehind_overrun:
94 # define HAVE_NEED_IP 1
96 # define NEED_IP(x) ((void) 0)
97 +# define TEST_IV(x) ((void) 0)
100 # define HAVE_NEED_OP 1
102 # define NEED_OP(x) ((void) 0)
103 +# define TEST_OV(x) ((void) 0)
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,
115 @@ -4361,6 +4377,7 @@ match:
123 @@ -4405,6 +4422,7 @@ match:
131 diff --git a/src/lzo1_d.ch b/src/lzo1_d.ch
132 index 40a5bfd..c442d9c 100644
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
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
160 @@ -135,11 +139,13 @@
161 # define HAVE_NEED_IP 1
163 # define NEED_IP(x) ((void) 0)
164 +# define TEST_IV(x) ((void) 0)
167 # define HAVE_NEED_OP 1
169 # define NEED_OP(x) ((void) 0)
170 +# define TEST_OV(x) ((void) 0)
174 diff --git a/src/lzo1b_d.ch b/src/lzo1b_d.ch
175 index fe5f361..36b4b6b 100644
178 @@ -187,6 +187,7 @@ match:
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
190 @@ -84,6 +84,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
198 @@ -138,6 +139,7 @@ match:
206 diff --git a/src/lzo1x_d.ch b/src/lzo1x_d.ch
207 index 49cf326..c804cc7 100644
210 @@ -120,6 +120,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
218 @@ -273,6 +274,7 @@ match:
226 @@ -317,6 +319,7 @@ match:
234 diff --git a/src/lzo2a_d.ch b/src/lzo2a_d.ch
235 index 48e51ca..954f07e 100644
238 @@ -131,6 +131,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,