libavcodec/psd : add test for channel depth/channel count in bitmap mode

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Martin Vignali 2017-01-11 21:47:56 +01:00 committed by Michael Niedermayer
parent e109c54a69
commit 31e722e9da
1 changed files with 6 additions and 0 deletions

View File

@ -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;