avcodec/truemotion1: Height not being a multiple of 4 is unsupported

mb_change_bits is given space based on height >> 2, while more data is read

Fixes: out of array access
Fixes: 62285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION1_fuzzer-5201925062590464.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ebdcf98499)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-03-26 02:52:04 +01:00
parent f2b70a4e6b
commit 45011af5b4
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 5 additions and 0 deletions

View File

@ -407,6 +407,11 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
return AVERROR_PATCHWELCOME;
}
if (s->h & 3) {
avpriv_request_sample(s->avctx, "Frame with height not being a multiple of 4");
return AVERROR_PATCHWELCOME;
}
if (s->w != s->avctx->width || s->h != s->avctx->height ||
new_pix_fmt != s->avctx->pix_fmt) {
av_frame_unref(s->frame);