Fixes: use of uninitialized memory Fixes: 421954767/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-515682786246656
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> --- libavcodec/shorten.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index ad2e7588d69..bed92936801 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -584,7 +584,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, AVFrame *frame, if (avpkt->size) { int max_framesize = s->blocksize * s->channels * 8; void *tmp_ptr; - + unsigned old_allocated_bitstream_size = s->allocated_bitstream_size; tmp_ptr = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, max_framesize + AV_INPUT_BUFFER_PADDING_SIZE); if (!tmp_ptr) { @@ -592,9 +592,8 @@ static int shorten_decode_frame(AVCodecContext *avctx, AVFrame *frame, return AVERROR(ENOMEM); } s->bitstream = tmp_ptr; - if (max_framesize > s->max_framesize) - memset(s->bitstream + s->max_framesize, 0, (max_framesize - s->max_framesize) + - AV_INPUT_BUFFER_PADDING_SIZE); + if (s->allocated_bitstream_size > old_allocated_bitstream_size) + memset(s->bitstream + old_allocated_bitstream_size, 0, s->allocated_bitstream_size - old_allocated_bitstream_size); s->max_framesize = FFMAX(s->max_framesize, max_framesize); *got_frame_ptr = 0; goto finish_frame; -- 2.50.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".