aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-07-24 22:55:15 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-02 19:41:48 +0100
commit8c66aed22bd5a8ed1d035220b403071be97d2c3b (patch)
treef2b028124d8928e6c631ed59dc8f809841afd0d2
parente46c1c68c65c375026c304f8a80f630ade9339e2 (diff)
downloadffmpeg-8c66aed22bd5a8ed1d035220b403071be97d2c3b.tar.gz
avcodec/assdec: undefined use of memcpy()
Fixes: null pointer passed as argument 2, which is declared to never be null Fixes: 16008/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SSA_fuzzer-5650582821404672 (this is a separate issue found in this testcase) Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 47b6ca0b022a413e392707464f2423795aa89bfb) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/assdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c
index 11dbde0b8a..1dbb15391e 100644
--- a/libavcodec/assdec.c
+++ b/libavcodec/assdec.c
@@ -32,7 +32,8 @@ static av_cold int ass_decode_init(AVCodecContext *avctx)
avctx->subtitle_header = av_malloc(avctx->extradata_size + 1);
if (!avctx->subtitle_header)
return AVERROR(ENOMEM);
- memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);
+ if (avctx->extradata_size)
+ memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);
avctx->subtitle_header[avctx->extradata_size] = 0;
avctx->subtitle_header_size = avctx->extradata_size;
avctx->priv_data = ff_ass_split(avctx->extradata);