Commit f0259a58 authored by Anton Khirnov's avatar Anton Khirnov

h264: check buffer size before accessing it

Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
parent 1f3e56b6
......@@ -4554,7 +4554,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
h->workaround_bugs |= FF_BUG_TRUNCATED;
if (!(h->workaround_bugs & FF_BUG_TRUNCATED))
while (ptr[dst_length - 1] == 0 && dst_length > 0)
while (dst_length > 0 && ptr[dst_length - 1] == 0)
dst_length--;
bit_length = !dst_length ? 0
: (8 * dst_length -
......
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