[Ffmpeg-cvslog] r8858 - trunk/libavcodec/h264.c

gpoirier subversion
Mon Apr 30 01:18:39 CEST 2007


Author: gpoirier
Date: Mon Apr 30 01:18:39 2007
New Revision: 8858

Log:
prevent going out of the buffer if the nal size does not fit in the buffer.
Patch by Mean % fixounet A free P fr %
Original thread:
Date: Apr 29, 2007 2:00 PM
Subject: Re: [Ffmpeg-devel] [patch] h264.c, dont go beyond buffer in h264_decode_nal_unit


Modified:
   trunk/libavcodec/h264.c

Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	(original)
+++ trunk/libavcodec/h264.c	Mon Apr 30 01:18:39 2007
@@ -8122,7 +8122,7 @@ static int decode_nal_units(H264Context 
         nalsize = 0;
         for(i = 0; i < h->nal_length_size; i++)
             nalsize = (nalsize << 8) | buf[buf_index++];
-        if(nalsize <= 1 || nalsize > buf_size){
+        if(nalsize <= 1 || (nalsize+buf_index > buf_size)){
             if(nalsize == 1){
                 buf_index++;
                 continue;




More information about the ffmpeg-cvslog mailing list