h264: check buffer size before accessing it
Fixes invalid reads. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org
This commit is contained in:

committed by
Sean McGovern

parent
fc53a09909
commit
af40847681
@@ -3941,7 +3941,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
|
|||||||
s->workaround_bugs |= FF_BUG_TRUNCATED;
|
s->workaround_bugs |= FF_BUG_TRUNCATED;
|
||||||
|
|
||||||
if (!(s->workaround_bugs & FF_BUG_TRUNCATED))
|
if (!(s->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--;
|
dst_length--;
|
||||||
bit_length = !dst_length ? 0
|
bit_length = !dst_length ? 0
|
||||||
: (8 * dst_length -
|
: (8 * dst_length -
|
||||||
|
Reference in New Issue
Block a user