From: Piotr Bandurski <ami_st...@o2.pl>

(cherry picked from commit b9c94e826e7551027754ecfa60e3e487e0c28fcb)
Signed-off-by: Diego Biurrun <di...@biurrun.de>
---

Includes the check for bpp == pixdepth now.

 libavcodec/xwddec.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/xwddec.c b/libavcodec/xwddec.c
index 387b697491..3be66dbb65 100644
--- a/libavcodec/xwddec.c
+++ b/libavcodec/xwddec.c
@@ -155,10 +155,13 @@ static int xwd_decode_frame(AVCodecContext *avctx, void 
*data,
     switch (vclass) {
     case XWD_STATIC_GRAY:
     case XWD_GRAY_SCALE:
-        if (bpp != 1)
+        if (bpp != 1 && bpp != 8 || bpp != pixdepth)
             return AVERROR_INVALIDDATA;
-        if (pixdepth == 1)
+        if (pixdepth == 1) {
             avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
+        } else if (pixdepth == 8) {
+            avctx->pix_fmt = AV_PIX_FMT_GRAY8;
+        }
         break;
     case XWD_STATIC_COLOR:
     case XWD_PSEUDO_COLOR:
-- 
2.11.0

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to