aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-07 18:50:49 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-14 12:20:16 +0200
commit85c8c0c826e78d159ea242ce64d7e8feeeeca741 (patch)
tree5c92c39b36da0de1a3e206583044b4a737d9ec52
parent332a9cbbf7dff12566b3592fc5f756a49812a724 (diff)
downloadffmpeg-85c8c0c826e78d159ea242ce64d7e8feeeeca741.tar.gz
avcodec/xwddec: Check bpp more completely
Fixes out of array access Fixes: 1399/clusterfuzz-testcase-minimized-4866094172995584 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 441026fcb13ac23aa10edc312bdacb6445a0ad06) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/xwddec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/xwddec.c b/libavcodec/xwddec.c
index 64cd8418a2..8b0845fc01 100644
--- a/libavcodec/xwddec.c
+++ b/libavcodec/xwddec.c
@@ -157,9 +157,9 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
case XWD_GRAY_SCALE:
if (bpp != 1 && bpp != 8)
return AVERROR_INVALIDDATA;
- if (pixdepth == 1) {
+ if (bpp == 1 && pixdepth == 1) {
avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
- } else if (pixdepth == 8) {
+ } else if (bpp == 8 && pixdepth == 8) {
avctx->pix_fmt = AV_PIX_FMT_GRAY8;
}
break;