# HG changeset patch # User michael # Date 1068674775 0 # Node ID 12530597714ccce563588c9fa42c4a68ddbc8f78 # Parent bccc4a9fcb3bc5b2f7926aeab585091459fa4f00 better fix diff -r bccc4a9fcb3b -r 12530597714c mjpeg.c --- 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;