[Ffmpeg-devel] [patch] h264.c, dont go beyond buffer in h264_decode_nal_unit
Mean
fixounet
Sun Apr 29 11:32:59 CEST 2007
Michael Niedermayer wrote:
>
>> Index: h264.c
>> ===================================================================
>> --- h264.c (revision 2980)
>> +++ h264.c (working copy)
>> @@ -8075,16 +8075,21 @@
>> int i, nalsize = 0;
>>
>> if(h->is_avc) {
>>
>
>
>> - if(buf_index >= buf_size) break;
>> + if(buf_index==buf_size) break;
>>
>
> how can these differ?
>
>
Ok
>
>> + if(buf_index +h->nal_length_size>= buf_size)
>> + {
>>
>
> { placement missmatches the rest of the file
> also this check is unneeded the buffer is a few bytes larger
> and nal_length_size is limited to 2 or 4
>
>
>
I'm under the impression that buf_size in most cases is given by the
user application alongside the buffer itself.
It is likely to hold a few bytes more, but how can one be sure ?
In my case, there was 3 extra bytess and nal_length_size=4, so one
extra byte was read from buffer (?).
Thanks
More information about the ffmpeg-devel
mailing list