[FFmpeg-devel] [PATCH] latmenc: Check for LOAS sync word

Michael Niedermayer michaelni at gmx.at
Wed Jan 16 02:34:21 CET 2013

On Tue, Jan 15, 2013 at 07:24:52PM -0300, James Almer wrote:
> On 15/01/13 6:59 PM, Michael Niedermayer wrote:
> > On Fri, Jan 11, 2013 at 09:27:37PM -0300, James Almer wrote:
> >> As Kunhya said, that's the extent of the header.
> >>
> >> I added a check to compare the size of the packet with the size
> >> reported at the end
> >> of the LOAS header (last 13 bits).
> >> That should make sure only actual LOAS packets pass the entire set of checks.
> > 
> > Iam not sure i understand, are you saying that
> > a non LOAS packet cannot pass the checks or
> > a non LOAS packet is unlikekly to pass the checks because you check
> > more bits ?
> > 
> > I think 24 bits is a bit weak if they arent forbidden to occur
> A non loas packet is very unlikely to pass the check, yes.
> It would have to start with the sync word (11 bits), and the next 13 bits should 
> match the value of pkt->size.
> The chances for this are very low, but still possible.

if the input was random (this is not true but its hard to work with
    something better due to complexity)
then a failure could be expected once in 16 million packets
assume 10 million FFmpeg users, 1% of them using this code 10 times
you would have 2 failures per second while they all use the code

This is a too high rate of failure

> There isn't much else to do if we want to let libfdk-aac send loas packets to
> the muxer, since that's the extent of the loas header and afaik there isn't 
> anything else we could check.
> The other option as i said is to remove the -latm avoption and make fdk-aac always
> send raw packets with the necessary extradata the muxer expects, so it can encapsulate 
> them itself.

you can check extradata
as a sideeffect it would fix the crash
with the right (well wrong) data the current patch not fix the crash


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130116/88efdc78/attachment.asc>

More information about the ffmpeg-devel mailing list