roqvideodec: improve end of input buffer check

This fixes a out of array read.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-03-02 02:32:14 +01:00
parent 1eb7f39c7b
commit 7a7b1f5c4d

View 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);