Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-08-31 21:15:09 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 19:34:49 +0300
commit22181868e3ef29a99b4ad4d7c0a1aa6fe022c6ff (patch)
treea19687b99e3a02de55b3fe8cfcd96fe040a400c8 /libavcodec
parentfdb61f366c56d075303961181555534627e33bec (diff)
avcodec/mpeg12dec: Do not put mpeg_f_code into an invalid state on error return
Fixes: invalid shift Fixes: 37018/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG2VIDEO_fuzzer-5290280902328320 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 5a95abcce4d93f979e4b53f2220f7a54edd03312) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpeg12dec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index c6a56fd5ae..3d1878a012 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1562,6 +1562,10 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
s->mpeg_f_code[0][1] = get_bits(&s->gb, 4);
s->mpeg_f_code[1][0] = get_bits(&s->gb, 4);
s->mpeg_f_code[1][1] = get_bits(&s->gb, 4);
+ s->mpeg_f_code[0][0] += !s->mpeg_f_code[0][0];
+ s->mpeg_f_code[0][1] += !s->mpeg_f_code[0][1];
+ s->mpeg_f_code[1][0] += !s->mpeg_f_code[1][0];
+ s->mpeg_f_code[1][1] += !s->mpeg_f_code[1][1];
if (!s->pict_type && s1->mpeg_enc_ctx_allocated) {
av_log(s->avctx, AV_LOG_ERROR,
"Missing picture start code, guessing missing values\n");
@@ -1575,10 +1579,6 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
s->current_picture.f->pict_type = s->pict_type;
s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
}
- s->mpeg_f_code[0][0] += !s->mpeg_f_code[0][0];
- s->mpeg_f_code[0][1] += !s->mpeg_f_code[0][1];
- s->mpeg_f_code[1][0] += !s->mpeg_f_code[1][0];
- s->mpeg_f_code[1][1] += !s->mpeg_f_code[1][1];
s->intra_dc_precision = get_bits(&s->gb, 2);
s->picture_structure = get_bits(&s->gb, 2);