Commit 3c2b8e70 authored by reimar's avatar reimar

Make sure we do not accidentially "fix" cnt to something < 0


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@7788 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 388ebf61
...@@ -87,11 +87,11 @@ static inline void copy(LZOContext *c, int cnt) { ...@@ -87,11 +87,11 @@ 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 (cnt > c->in_end - src) { if (cnt > c->in_end - src) {
cnt = c->in_end - src; cnt = FFMAX(c->in_end - src, 0);
c->error |= LZO_INPUT_DEPLETED; c->error |= LZO_INPUT_DEPLETED;
} }
if (cnt > c->out_end - dst) { if (cnt > c->out_end - dst) {
cnt = c->out_end - dst; cnt = FFMAX(c->out_end - dst, 0);
c->error |= LZO_OUTPUT_FULL; c->error |= LZO_OUTPUT_FULL;
} }
#if defined(INBUF_PADDED) && defined(OUTBUF_PADDED) #if defined(INBUF_PADDED) && defined(OUTBUF_PADDED)
...@@ -122,7 +122,7 @@ static inline void copy_backptr(LZOContext *c, int back, int cnt) { ...@@ -122,7 +122,7 @@ static inline void copy_backptr(LZOContext *c, int back, int cnt) {
return; return;
} }
if (cnt > c->out_end - dst) { if (cnt > c->out_end - dst) {
cnt = c->out_end - dst; cnt = FFMAX(c->out_end - dst, 0);
c->error |= LZO_OUTPUT_FULL; c->error |= LZO_OUTPUT_FULL;
} }
if (back == 1) { if (back == 1) {
......
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