Commit 388ebf61 authored by reimar's avatar reimar

Simplify checks, use that we know that cnt will not be < 0


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@7787 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent e3be1da3
...@@ -86,11 +86,11 @@ static inline int get_len(LZOContext *c, int x, int mask) { ...@@ -86,11 +86,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 || src + cnt < src) { if (cnt > c->in_end - 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 || dst + cnt < dst) { if (cnt > c->out_end - dst) {
cnt = c->out_end - dst; cnt = c->out_end - dst;
c->error |= LZO_OUTPUT_FULL; c->error |= LZO_OUTPUT_FULL;
} }
...@@ -121,7 +121,7 @@ static inline void copy_backptr(LZOContext *c, int back, int cnt) { ...@@ -121,7 +121,7 @@ static inline void copy_backptr(LZOContext *c, int back, int cnt) {
c->error |= LZO_INVALID_BACKPTR; c->error |= LZO_INVALID_BACKPTR;
return; return;
} }
if (dst + cnt > c->out_end || dst + cnt < dst) { if (cnt > c->out_end - dst) {
cnt = c->out_end - dst; cnt = c->out_end - dst;
c->error |= LZO_OUTPUT_FULL; c->error |= LZO_OUTPUT_FULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment