|
|
@ -67,11 +67,11 @@ static inline int get_len(LZOContext *c, int x, int mask) { |
|
|
|
static inline void copy(LZOContext *c, int cnt) { |
|
|
|
static inline void copy(LZOContext *c, int cnt) { |
|
|
|
register uint8_t *src = c->in; |
|
|
|
register uint8_t *src = c->in; |
|
|
|
register uint8_t *dst = c->out; |
|
|
|
register uint8_t *dst = c->out; |
|
|
|
if (src + cnt > c->in_end) { |
|
|
|
if (src + cnt > c->in_end || src + cnt < src) { |
|
|
|
cnt = c->in_end - src; |
|
|
|
cnt = c->in_end - src; |
|
|
|
c->error |= LZO_INPUT_DEPLETED; |
|
|
|
c->error |= LZO_INPUT_DEPLETED; |
|
|
|
} |
|
|
|
} |
|
|
|
if (dst + cnt > c->out_end) { |
|
|
|
if (dst + cnt > c->out_end || dst + cnt < dst) { |
|
|
|
cnt = c->out_end - dst; |
|
|
|
cnt = c->out_end - dst; |
|
|
|
c->error |= LZO_OUTPUT_FULL; |
|
|
|
c->error |= LZO_OUTPUT_FULL; |
|
|
|
} |
|
|
|
} |
|
|
@ -101,11 +101,11 @@ static inline void copy(LZOContext *c, int cnt) { |
|
|
|
static inline void copy_backptr(LZOContext *c, int back, int cnt) { |
|
|
|
static inline void copy_backptr(LZOContext *c, int back, int cnt) { |
|
|
|
register uint8_t *src = &c->out[-back]; |
|
|
|
register uint8_t *src = &c->out[-back]; |
|
|
|
register uint8_t *dst = c->out; |
|
|
|
register uint8_t *dst = c->out; |
|
|
|
if (src < c->out_start) { |
|
|
|
if (src < c->out_start || src > dst) { |
|
|
|
c->error |= LZO_INVALID_BACKPTR; |
|
|
|
c->error |= LZO_INVALID_BACKPTR; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (dst + cnt > c->out_end) { |
|
|
|
if (dst + cnt > c->out_end || dst + cnt < dst) { |
|
|
|
cnt = c->out_end - dst; |
|
|
|
cnt = c->out_end - dst; |
|
|
|
c->error |= LZO_OUTPUT_FULL; |
|
|
|
c->error |= LZO_OUTPUT_FULL; |
|
|
|
} |
|
|
|
} |
|
|
|