diff mbox series

[FFmpeg-devel,3/3] avcodec/hapdec: Clear tex buffer

Message ID 20240814143421.3990034-3-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/3] avformat/iamf_parse: clear padding | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Michael Niedermayer Aug. 14, 2024, 2:34 p.m. UTC
The code following makes no attempt to initialize all of the buffer

Fixes: use of uninitialized value
Fixes: 70980/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5329909059223552

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/hapdec.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index 918eff78761..70bf592f2aa 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -310,6 +310,7 @@  static int hap_decode(AVCodecContext *avctx, AVFrame *frame,
             ret = av_reallocp(&ctx->tex_buf, ctx->tex_size);
             if (ret < 0)
                 return ret;
+            memset(ctx->tex_buf, 0, ctx->tex_size);
 
             avctx->execute2(avctx, decompress_chunks_thread, NULL,
                             ctx->chunk_results, ctx->chunk_count);