From 3e2f200237af977b9253b0aff121eee27bcedb44 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 6 Mar 2013 09:15:19 +0100 Subject: roqvideodec: fix a potential infinite loop in roqvideo_decode_frame(). When there is just 1 byte remanining in the buffer, nothing will be read and the loop will continue forever. Check that there are at least 8 bytes, which are always read at the beginning. CC:libav-stable@libav.org --- libavcodec/roqvideodec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavcodec/roqvideodec.c') diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c index ef561a3210..39233be87c 100644 --- a/libavcodec/roqvideodec.c +++ b/libavcodec/roqvideodec.c @@ -44,7 +44,7 @@ static void roqvideo_decode_frame(RoqContext *ri) roq_qcell *qcell; int64_t chunk_start; - while (bytestream2_get_bytes_left(&ri->gb) > 0) { + while (bytestream2_get_bytes_left(&ri->gb) >= 8) { chunk_id = bytestream2_get_le16(&ri->gb); chunk_size = bytestream2_get_le32(&ri->gb); chunk_arg = bytestream2_get_le16(&ri->gb); -- cgit v1.2.3