[Ffmpeg-devel] Frank patch to h264.c for robustness
Loren Merritt
lorenm
Wed Dec 6 23:14:48 CET 2006
On Wed, 6 Dec 2006, Stefan Gehrer wrote:
> Michael Niedermayer wrote:
>>
>>> @@ -8117,6 +8139,12 @@
>>> buf_index+=3;
>>> }
>>> + + if ( h->is_avc && nalsize > 1000000 ) + { +
>>> // frank prevent problem when seeking in a h264 mov file. +
>>> return -1;
>>> + }
>>
>> whatever this is supposed to do it is wrong, nalsize can very well be
>> arbitrary large
>
> I think a maximum NAL size can be derived from the level by
> considering the maximum allowed frame size and the minimum
> compression ratio (2 for most levels). From my understanding of the
> spec this would give a largest possible NAL size of 6.75 MB.
> Don't know if checking for such a size really improves error
> robustness significantly though.
Minimum compression ratio is waived for high profile, otherwise lossless
would be impossible. And anyway, do you want to forbid larger frames just
because the standard's table doesn't go that high? I don't see anything
wrong with a 4000x4000 resolution, it just wouldn't be levels compliant.
A more appropriate sanity check would be (nalsize > buf_size).
--Loren Merritt
More information about the ffmpeg-devel
mailing list