On Mon, Dec 06, 2021 at 11:17:17AM +0100, Michael Niedermayer wrote:
> On Mon, Dec 06, 2021 at 11:04:09AM +0100, Anton Khirnov wrote:
> > Quoting Michael Niedermayer (2021-12-04 22:32:56)
> > > Fixes: Timeout
> > > Fixes: 
> > > 41446/clusterfuzz-testcase-minimized-ffmpeg_dem_SAMI_fuzzer-4667644540747776
> > > 
> > > Found-by: continuous fuzzing process 
> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
> > > ---
> > >  libavcodec/avpacket.c | 7 ++++++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> > > index d8d8fef3b9e..b10498bfc1d 100644
> > > --- a/libavcodec/avpacket.c
> > > +++ b/libavcodec/avpacket.c
> > > @@ -142,7 +142,12 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
> > >  
> > >          if (new_size + data_offset > pkt->buf->size ||
> > >              !av_buffer_is_writable(pkt->buf)) {
> > > -            int ret = av_buffer_realloc(&pkt->buf, new_size + 
> > > data_offset);
> > > +            int ret;
> > > +
> > > +            if (new_size + data_offset < INT_MAX - new_size/16)
> > > +                new_size += new_size/16;
> > > +
> > > +            ret = av_buffer_realloc(&pkt->buf, new_size + data_offset);
> > 
> > This needs a comment, e.g.
> > // allocate slightly more than requested to avoid excessive
> > // reallocations
> 
> above comment added

will apply

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to