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

Sean McGovern gseanmcg
Wed Mar 2 01:28:26 CET 2011


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");
+
         av_free(avctx->extradata);
         avctx->extradata      = out;
         avctx->extradata_size = total_size;
-- 
1.7.4




More information about the ffmpeg-devel mailing list