aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-04-29 21:21:27 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-11 21:23:49 +0200
commit78da48bb741cdcd1adfa3ea99ba96bd5e2add3d4 (patch)
treeb28a0a66b2672defdeef398837cfde76def0076d
parent2a5d44e3cb461a172e4bbb86de1fd9ee9ad42a32 (diff)
downloadffmpeg-78da48bb741cdcd1adfa3ea99ba96bd5e2add3d4.tar.gz
avcodec/utils: treat PAL8 for jpegs similar to other colorspaces
Fixes: out of array access Fixes: 33713/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5778775641030656 Fixes: 33717/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEGLS_fuzzer-4960397238075392 Fixes: 33718/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMVJPEG_fuzzer-5314270096130048.fuzz Fixes: 33719/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5352721864589312 Fixes: 33721/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THP_fuzzer-5938892055379968 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 f0ce023ddb8863d16ab650fcc0731851a55db084) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 3af627175f..13f8804fbc 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -395,6 +395,16 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
w_align = 8;
h_align = 8;
}
+ if (s->codec_id == AV_CODEC_ID_MJPEG ||
+ s->codec_id == AV_CODEC_ID_MJPEGB ||
+ s->codec_id == AV_CODEC_ID_LJPEG ||
+ s->codec_id == AV_CODEC_ID_SMVJPEG ||
+ s->codec_id == AV_CODEC_ID_AMV ||
+ s->codec_id == AV_CODEC_ID_SP5X ||
+ s->codec_id == AV_CODEC_ID_JPEGLS) {
+ w_align = 8;
+ h_align = 2*8;
+ }
break;
case AV_PIX_FMT_BGR24:
if ((s->codec_id == AV_CODEC_ID_MSZH) ||