roqvideodec: improve end of input buffer check
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 2 Mar 2012 01:32:14 +0000 (02:32 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 2 Mar 2012 01:32:14 +0000 (02:32 +0100)
This fixes a out of array read.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/roqvideodec.c

index 161e7da..6085f4a 100644 (file)
@@ -44,7 +44,7 @@ static void roqvideo_decode_frame(RoqContext *ri)
     const unsigned char *buf = ri->buf;
     const unsigned char *buf_end = ri->buf + ri->size;
 
-    while (buf < buf_end) {
+    while (buf + 8 <= buf_end) {
         chunk_id = bytestream_get_le16(&buf);
         chunk_size = bytestream_get_le32(&buf);
         chunk_arg = bytestream_get_le16(&buf);