[FFmpeg-devel] [PATCH v2 08/13] avpriv_find_start_code(): add parameter for ignoring history

Scott Theisen scott.the.elm at gmail.com
Sat Feb 5 11:00:08 EET 2022


On 2/5/22 01:10, Andreas Rheinhardt wrote:
> 1. This patch is absolutely unacceptable: It breaks ABI.
> 2. I am surprised that there is apparently only one user that actually
> wants this feature of state being an input parameter, namely
> (ff_)mpeg1_find_frame_end(). This means that this loop done before the
> new check should actually be made by this caller alone, obviating the
> need to change the signature.
> 3. Given that no user of this in libavformat wants this feature,
> changing it is IMO acceptable from an ABI-point of view.

I'll look into it.

> 4. There might be some slight changes introduced by this though:
> Consider 00 00 01 00 00 01 xy. If the initial state is -1, a call to
> avpriv_find_start_code() will treat the initial four bytes as start code
> and return a pointer to the byte preceding the second 0x01. If the user
> does not reset the start code between calls to avpriv_find_start_code(),
> the second call will combine the last zero byte of the start code with
> the rest to form another start code that partially overlaps with the
> earlier one. This is (probably) invalid data (definitely for H.262,
> H.264 and HEVC).

With input buffer 00 00 01 00 00 01 xy ...
The code in master will (incorrectly) find a second start code at offset 7.
It would need to check if (*start_code == 0x100) and invalidate it.

-Scott



More information about the ffmpeg-devel mailing list