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)
Unified · Split
| @@ -31,7 +31,8 @@ static av_cold int ass_decode_init(AVCodecContext *avctx) · 30 unmodified lines | |||
| 31 | avctx->subtitle_header = av_malloc(avctx->extradata_size + 1); | 31 | avctx->subtitle_header = av_malloc(avctx->extradata_size + 1); |
| 32 | if (!avctx->subtitle_header) | 32 | if (!avctx->subtitle_header) |
| 33 | return AVERROR(ENOMEM); | 33 | return AVERROR(ENOMEM); |
| 34 | memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size); | 34 | if (avctx->extradata_size) |
| 35 | memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size); | ||
| 35 | avctx->subtitle_header[avctx->extradata_size] = 0; | 36 | avctx->subtitle_header[avctx->extradata_size] = 0; |
| 36 | avctx->subtitle_header_size = avctx->extradata_size; | 37 | avctx->subtitle_header_size = avctx->extradata_size; |
| 37 | return 0; | 38 | return 0; |