[FFmpeg-devel] [PATCH] Don't call memset() unless output buffer is non-NULL, otherwise warn if it is NULL.

Michael Niedermayer michaelni
Wed Mar 2 13:02:45 CET 2011


On Wed, Mar 02, 2011 at 12:38:56AM +0000, M?ns Rullg?rd wrote:
> Sean McGovern <gseanmcg at gmail.com> writes:
> 
> > This corrects roundup issue #2386.
> > ---
> >  libavcodec/h264_mp4toannexb_bsf.c |    6 +++++-
> >  1 files changed, 5 insertions(+), 1 deletions(-)
> >
> > diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c
> > index d4a7f31..7767206 100644
> > --- a/libavcodec/h264_mp4toannexb_bsf.c
> > +++ b/libavcodec/h264_mp4toannexb_bsf.c
> > @@ -114,7 +114,11 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
> >                  unit_nb = *extradata++; /* number of pps unit(s) */
> >          }
> >  
> > -        memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
> > +        if(out)
> > +            memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
> > +        else
> > +            av_log(avctx, AV_LOG_WARNING, "Warning: output buffer not allocated.\n");
> 
> It would be better to warn about the underlying issue, i.e. missing or
> malformatted SPS/PPS.  The buffer not being allocated is merely a side
> effect of this.

yes that would be better

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

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110302/c0751f55/attachment.pgp>



More information about the ffmpeg-devel mailing list