diff mbox

[FFmpeg-devel] libavcodec/psd : add test for channel depth/count in bitmap mode

Message ID CAJiLW2MGOCp=3AdE92SWHOjNG9PmhgoDWTKWNj9vbJuwTE0oow@mail.gmail.com
State Accepted
Headers show

Commit Message

Martin Vignali Jan. 11, 2017, 8:55 p.m. UTC
Hello,

Patch in attach add test for channel depth and channel count in bitmap mode
and return invalid data, if channel count or depth != 1.

Martin

Comments

Michael Niedermayer Jan. 14, 2017, 2:48 a.m. UTC | #1
On Wed, Jan 11, 2017 at 09:55:33PM +0100, Martin Vignali wrote:
> Hello,
> 
> Patch in attach add test for channel depth and channel count in bitmap mode
> and return invalid data, if channel count or depth != 1.
> 
> Martin

>  psd.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 5b8783f5ee2bce63c5b1b19953e249069fe81384  0001-libavcodec-psd-add-test-for-channel-depth-channel-co.patch
> From e1ae30182861bebbee7ce640db4e7038bff09e75 Mon Sep 17 00:00:00 2001
> From: Martin Vignali <martin.vignali@gmail.com>
> Date: Wed, 11 Jan 2017 21:47:56 +0100
> Subject: [PATCH 1/2] libavcodec/psd : add test for channel depth/channel count
>  in bitmap mode

applied

thx

[...]
diff mbox

Patch

From e1ae30182861bebbee7ce640db4e7038bff09e75 Mon Sep 17 00:00:00 2001
From: Martin Vignali <martin.vignali@gmail.com>
Date: Wed, 11 Jan 2017 21:47:56 +0100
Subject: [PATCH 1/2] libavcodec/psd : add test for channel depth/channel count
 in bitmap mode

---
 libavcodec/psd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/psd.c b/libavcodec/psd.c
index 4d6b0e3..66f2ec2 100644
--- a/libavcodec/psd.c
+++ b/libavcodec/psd.c
@@ -319,6 +319,12 @@  static int decode_frame(AVCodecContext *avctx, void *data,
 
     switch (s->color_mode) {
     case PSD_BITMAP:
+        if (s->channel_depth != 1 || s->channel_count != 1) {
+            av_log(s->avctx, AV_LOG_ERROR,
+                    "Invalid bitmap file (channel_depth %d, channel_count %d)\n",
+                    s->channel_depth, s->channel_count);
+            return AVERROR_INVALIDDATA;
+        }
         s->line_size = s->width + 7 >> 3;
         avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
         break;
-- 
1.9.3 (Apple Git-50)