summaryrefslogtreecommitdiff
path: root/libavcodec/psd.c
diff options
context:
space:
mode:
authorMartin Vignali <martin.vignali@gmail.com>2017-01-11 21:47:56 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-01-14 04:52:43 +0100
commit31e722e9da0bab02da91eeb7a27a3a458f66aaa5 (patch)
treea50875b0b3ace616ad992a5b6d061cd7c66c150d /libavcodec/psd.c
parente109c54a697b6cbd2a5b27cb9e8df2729e73351c (diff)
libavcodec/psd : add test for channel depth/channel count in bitmap mode
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/psd.c')
-rw-r--r--libavcodec/psd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/psd.c b/libavcodec/psd.c
index 4d6b0e305f..66f2ec28d7 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;