summaryrefslogtreecommitdiff
path: root/libavcodec/adpcm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-04-19 16:20:55 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-05-12 23:00:07 +0200
commit7a403da0cb8e5fe308fe307b7ed219110f7021e0 (patch)
tree368c1f7a5ca0a57a77cadd16e23707847cc6888c /libavcodec/adpcm.c
parent38c47615880357314ba30727a85bf7b00989706a (diff)
avcodec/adpcm: Set vqa_version before use in init
Fixes: null pointer dereference Fixes: 33172/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_WS_fuzzer-5200164273913856 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/adpcm.c')
-rw-r--r--libavcodec/adpcm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 94e1fade28..5e0a654caf 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -193,6 +193,8 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
break;
case AV_CODEC_ID_ADPCM_IMA_WS:
+ if (avctx->extradata && avctx->extradata_size >= 2)
+ c->vqa_version = AV_RL16(avctx->extradata);
avctx->sample_fmt = c->vqa_version == 3 ? AV_SAMPLE_FMT_S16P :
AV_SAMPLE_FMT_S16;
break;