changeset 4450:224f2889a9df libavcodec

Make sure we do not accidentially "fix" cnt to something < 0
author reimar
date Wed, 31 Jan 2007 21:20:31 +0000
parents cb49f6384eb5
children 9fa2c8a7e4d8
files lzo.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lzo.c	Wed Jan 31 21:00:48 2007 +0000
+++ b/lzo.c	Wed Jan 31 21:20:31 2007 +0000
@@ -87,11 +87,11 @@
     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 @@
         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) {