Skip to content

Commit

Permalink
roqvideodec: fix a potential infinite loop in roqvideo_decode_frame().
Browse files Browse the repository at this point in the history
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
  • Loading branch information
elenril committed Mar 8, 2013
1 parent 8a49d2b commit 3e2f200
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libavcodec/roqvideodec.c
Expand Up @@ -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);
Expand Down

0 comments on commit 3e2f200

Please sign in to comment.