aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/pngdec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index fa7f7cc0a6..dec5bd512c 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -415,9 +415,10 @@ static int decode_frame(AVCodecContext *avctx,
/* check signature */
if (buf_size < 8 ||
- memcmp(buf, ff_pngsig, 8) != 0 &&
- memcmp(buf, ff_mngsig, 8) != 0)
- return -1;
+ (memcmp(buf, ff_pngsig, 8) != 0 && memcmp(buf, ff_mngsig, 8) != 0)) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid PNG signature (%d).\n", buf_size);
+ return AVERROR_INVALIDDATA;
+ }
bytestream2_init(&s->gb, buf + 8, buf_size - 8);
s->y = s->state = 0;