changeset 1619:12530597714c libavcodec

better fix
author michael
date Wed, 12 Nov 2003 22:06:15 +0000
parents bccc4a9fcb3b
children 161632b8dbb4
files mjpeg.c
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mjpeg.c	Wed Nov 12 22:01:13 2003 +0000
+++ b/mjpeg.c	Wed Nov 12 22:06:15 2003 +0000
@@ -1681,7 +1681,7 @@
     while (buf_ptr < buf_end) {
         v = *buf_ptr++;
 	v2 = *buf_ptr;
-        if ((v == 0xff) && (v2 >= 0xc0) && (v2 <= 0xfe)) {
+        if ((v == 0xff) && (v2 >= 0xc0) && (v2 <= 0xfe) && buf_ptr < buf_end) {
 	    val = *buf_ptr++;
 	    goto found;
         }
@@ -1874,9 +1874,6 @@
         }
     }
 the_end:
-    if(buf_ptr > buf_end)
-      buf_ptr = buf_end;
-
     dprintf("mjpeg decode frame unused %d bytes\n", buf_end - buf_ptr);
 //    return buf_end - buf_ptr;
     return buf_ptr - buf;