diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2024-03-26 01:46:02 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2024-03-26 23:19:49 +0100 |
commit | 48eeb198a55852ccb4b57cb73c4658767252614e (patch) | |
tree | 839af5899f68e83398decfe10436c4f307f48e5b /libavcodec/hcadec.c | |
parent | addb85ea39300c36010ffb6dc0d28b2ea62b4805 (diff) | |
download | ffmpeg-48eeb198a55852ccb4b57cb73c4658767252614e.tar.gz |
avcodec/hcadec: do not allow code to continue after failed init
Fixes: 62285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-6247136417087488
Fixes: out of array write
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/hcadec.c')
-rw-r--r-- | libavcodec/hcadec.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c index 8c8c235f7b..88146c7cdd 100644 --- a/libavcodec/hcadec.c +++ b/libavcodec/hcadec.c @@ -538,8 +538,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, return AVERROR_INVALIDDATA; } else if (AV_RB16(avpkt->data + 6) <= avpkt->size) { ret = init_hca(avctx, avpkt->data, AV_RB16(avpkt->data + 6)); - if (ret < 0) + if (ret < 0) { + c->crc_table = NULL; // signal that init has not finished return ret; + } offset = AV_RB16(avpkt->data + 6); if (offset == avpkt->size) return avpkt->size; |