Commit 3e2f2002 authored by Anton Khirnov's avatar Anton Khirnov

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
parent 8a49d2bc
...@@ -44,7 +44,7 @@ static void roqvideo_decode_frame(RoqContext *ri) ...@@ -44,7 +44,7 @@ static void roqvideo_decode_frame(RoqContext *ri)
roq_qcell *qcell; roq_qcell *qcell;
int64_t chunk_start; 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_id = bytestream2_get_le16(&ri->gb);
chunk_size = bytestream2_get_le32(&ri->gb); chunk_size = bytestream2_get_le32(&ri->gb);
chunk_arg = bytestream2_get_le16(&ri->gb); chunk_arg = bytestream2_get_le16(&ri->gb);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment