From bc6a3bd4a544608211f006e2d2868cbed4e1fde6 Mon Sep 17 00:00:00 2001 From: Alexander Strange Date: Mon, 12 Dec 2011 18:13:39 -0500 Subject: [PATCH] h264: Fix a possible overread in decode_nal_units() Signed-off-by: Anton Khirnov --- libavcodec/h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index a9a10513e3..2bde0fec2a 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3764,7 +3764,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ int err; if(buf_index >= next_avc) { - if(buf_index >= buf_size) break; + if (buf_index >= buf_size - h->nal_length_size) break; nalsize = 0; for(i = 0; i < h->nal_length_size; i++) nalsize = (nalsize << 8) | buf[buf_index++];