aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-06-01 19:06:07 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-11 20:18:45 +0100
commit3216a7fac64b5e09d1fdc19d8362d5e894127feb (patch)
tree9243fd5e8f5edecfe89ce23c50b2557b5939908d /libavcodec
parentb91cc74386c6291d4afe66f2fcc173d68457929b (diff)
downloadffmpeg-3216a7fac64b5e09d1fdc19d8362d5e894127feb.tar.gz
avcodec/mjpegdec: Check for non ls PAL8
Fixes: Null-dereference READ in av_malloc Fixes: 15002/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THP_fuzzer-5643474625363968 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 442375fee7f1fb15e42fbc128dc38bdfcc2cc105) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mjpegdec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 58c4c053a9..f7b6ac71d6 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -699,7 +699,9 @@ unk_pixfmt:
}
if ((s->rgb && !s->lossless && !s->ls) ||
- (!s->rgb && s->ls && s->nb_components > 1)) {
+ (!s->rgb && s->ls && s->nb_components > 1) ||
+ (s->avctx->pix_fmt == AV_PIX_FMT_PAL8 && !s->ls)
+ ) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported coding and pixel format combination\n");
return AVERROR_PATCHWELCOME;
}