summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-15 10:15:24 +0100
committerAnton Khirnov <anton@khirnov.net>2013-11-21 20:54:20 +0100
commitf0259a587ee3419dd894873ea617b4c98eeaca1c (patch)
tree66f947c03fc49ab29504130040289cd0071b775b /libavcodec
parent1f3e56b6dcc163a705704e98569d4850a31d651c (diff)
h264: check buffer size before accessing it
Fixes invalid reads. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 62e4940dc1..86d453bba7 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -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 -