diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c index 161e7da08a..6085f4a7d0 100644 --- a/libavcodec/roqvideodec.c +++ b/libavcodec/roqvideodec.c @@ -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);