[FFmpeg-devel] [PATCH] Don't call memset() unless output buffer is non-NULL, otherwise warn if it is NULL.
Måns Rullgård
mans
Wed Mar 2 01:38:56 CET 2011
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.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list