[FFmpeg-devel] [PATCH 1/2] avcodec/avpacket: Use av_copy_packet_side_data() in av_packet_copy_props()

Michael Niedermayer michael at niedermayer.cc
Wed May 3 12:45:32 EEST 2017


On Wed, May 03, 2017 at 12:46:29AM -0300, James Almer wrote:
> On 5/3/2017 12:21 AM, Michael Niedermayer wrote:
> > Fixes timeout
> > Fixes: 1293/clusterfuzz-testcase-minimized-6054752074858496
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavcodec/avpacket.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> > index 4bf830bb8a..ff7ee730a4 100644
> > --- a/libavcodec/avpacket.c
> > +++ b/libavcodec/avpacket.c
> > @@ -557,6 +557,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
> >      dst->flags                = src->flags;
> >      dst->stream_index         = src->stream_index;
> >  
> > +    if (!dst->side_data_elems);
> > +        return av_copy_packet_side_data(dst, src);.
> 
> This is a deprecated function, so ideally you'd use something else.

av_copy_packet_side_data() isnt marked as deprecated in avcodec.h


> 
> How does this fixes the problem anyway? The code below copies the
> packet's side data as well.

I suspect calling realloc() repetly to add 1 element each time is
expensive in some cases like at least some memory debuggers/checkers

It should always be better to avoid repeatly reallocating

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170503/622868ee/attachment.sig>


More information about the ffmpeg-devel mailing list