diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2007-01-31 21:20:31 +0000 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2007-01-31 21:20:31 +0000 |
commit | c215e403167dc33cbad38a8adb6cf8aa0ff69c94 (patch) | |
tree | 150286d0ad238fe1bdbcefb7550f96a33490b14e | |
parent | c0a8b87600a1c24a65898d985c11adda56fa6104 (diff) | |
download | ffmpeg-c215e403167dc33cbad38a8adb6cf8aa0ff69c94.tar.gz |
Make sure we do not accidentially "fix" cnt to something < 0
Originally committed as revision 7788 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/lzo.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/lzo.c b/libavcodec/lzo.c index 54edc800ac..d3849a743d 100644 --- a/libavcodec/lzo.c +++ b/libavcodec/lzo.c @@ -87,11 +87,11 @@ static inline void copy(LZOContext *c, int cnt) { register uint8_t *src = c->in; register uint8_t *dst = c->out; if (cnt > c->in_end - src) { - cnt = c->in_end - src; + cnt = FFMAX(c->in_end - src, 0); c->error |= LZO_INPUT_DEPLETED; } if (cnt > c->out_end - dst) { - cnt = c->out_end - dst; + cnt = FFMAX(c->out_end - dst, 0); c->error |= LZO_OUTPUT_FULL; } #if defined(INBUF_PADDED) && defined(OUTBUF_PADDED) @@ -122,7 +122,7 @@ static inline void copy_backptr(LZOContext *c, int back, int cnt) { return; } if (cnt > c->out_end - dst) { - cnt = c->out_end - dst; + cnt = FFMAX(c->out_end - dst, 0); c->error |= LZO_OUTPUT_FULL; } if (back == 1) { |