Browse code

Do not try to read 16bit gray png files with alpha channel.

FFmpeg does not support gray16a.
Fixes the crash in ticket #644.
(cherry picked from commit 0c5fd6372e6c257912d7ae64cbfc4d8541f0452f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Carl Eugen Hoyos authored on 2011/11/13 03:30:27
Showing 1 changed files
... ...
@@ -471,7 +471,8 @@ static int decode_frame(AVCodecContext *avctx,
471 471
                     avctx->pix_fmt = PIX_FMT_MONOBLACK;
472 472
                 } else if (s->color_type == PNG_COLOR_TYPE_PALETTE) {
473 473
                     avctx->pix_fmt = PIX_FMT_PAL8;
474
-                } else if (s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
474
+                } else if (s->bit_depth == 8 &&
475
+                           s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
475 476
                     avctx->pix_fmt = PIX_FMT_GRAY8A;
476 477
                 } else {
477 478
                     goto fail;