15 #include <linux/module.h>
16 #include <linux/kernel.h>
19 #include <asm/unaligned.h>
23 #define HAVE_IP(x, ip_end, ip) ((size_t)(ip_end - ip) < (x))
24 #define HAVE_OP(x, op_end, op) ((size_t)(op_end - op) < (x))
25 #define HAVE_LB(m_pos, out, op) (m_pos < out || m_pos >= op)
27 #define COPY4(dst, src) \
28 put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst))
33 const unsigned char *
const ip_end = in +
in_len;
34 unsigned char *
const op_end = out + *
out_len;
35 const unsigned char *
ip =
in, *m_pos;
36 unsigned char *
op =
out;
52 goto first_literal_run;
55 while ((ip < ip_end)) {
107 goto lookbehind_overrun;
121 m_pos -= (t >> 2) & 7;
125 goto lookbehind_overrun;
126 if (
HAVE_OP(t + 3 - 1, op_end, op))
129 }
else if (t >= 32) {
143 m_pos -= get_unaligned_le16(ip) >> 2;
145 }
else if (t >= 16) {
147 m_pos -= (t & 8) << 11;
161 m_pos -= get_unaligned_le16(ip) >> 2;
172 goto lookbehind_overrun;
182 goto lookbehind_overrun;
183 if (
HAVE_OP(t + 3 - 1, op_end, op))
186 if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) {
216 if (
HAVE_IP(t + 1, ip_end, ip))
227 }
while (ip < ip_end);