[FFmpeg-devel] [PATCH 5/5 v2] avformat: add an AV1 Annex B demuxer

Ronald S. Bultje rsbultje at gmail.com
Tue Nov 12 23:19:26 EET 2019


Hi,

On Tue, Nov 12, 2019 at 8:09 AM James Almer <jamrial at gmail.com> wrote:

> On 11/12/2019 2:52 AM, Ronald S. Bultje wrote:
> > Hi,
> >
> > On Mon, Nov 11, 2019 at 9:17 PM James Almer <jamrial at gmail.com> wrote:
> >
> >> +static int leb(AVIOContext *pb, uint32_t *len) {
> >>
> >
> >  this can overflow, should be uint64_t.
> >
> >
> >> +        unsigned bits;
> >>
> >
> > Same.
> >
> > Ronald
>
> I used the same method as in dav1d, it will not overflow as it will not
> try to load more than five bytes worth leb128 data, ensuring to only
> accept up to 4 bits from the last, resulting in assembled values up to
> UINT32_MAX.


Oh, you are right, I was looking at "if (++i == 8 && more)", but the line
above it ("if (i <= 3 || (i == 4 && bits < (1 << 4)))") demonstrates
quickly that this is different. It's OK here, although a bit confusing, but
I should probably fix that in dav1d first.

Rest of patchset lgtm, and thanks for adding this feature, this is
genuinely very useful for AV1 users in more complex AV1 processing
pipelines. Section5 would be nice also ;-).

Ronald


More information about the ffmpeg-devel mailing list