[FFmpeg-cvslog] h264: Fix a possible overread in decode_nal_units()

Alexander Strange git at videolan.org
Sat Dec 24 01:00:29 CET 2011


ffmpeg | branch: master | Alexander Strange <astrange at ithinksw.com> | Mon Dec 12 18:13:39 2011 -0500| [bc6a3bd4a544608211f006e2d2868cbed4e1fde6] | committer: Anton Khirnov

h264: Fix a possible overread in decode_nal_units()

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bc6a3bd4a544608211f006e2d2868cbed4e1fde6
---

 libavcodec/h264.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index a9a1051..2bde0fe 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++];



More information about the ffmpeg-cvslog mailing list