Commit 1e763454 authored by Vittorio Giovara's avatar Vittorio Giovara

png: improve signature check

Return proper error code, print an error message and add missing
parentheses.
parent 456ffec3
...@@ -415,9 +415,10 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -415,9 +415,10 @@ static int decode_frame(AVCodecContext *avctx,
/* check signature */ /* check signature */
if (buf_size < 8 || if (buf_size < 8 ||
memcmp(buf, ff_pngsig, 8) != 0 && (memcmp(buf, ff_pngsig, 8) != 0 && memcmp(buf, ff_mngsig, 8) != 0)) {
memcmp(buf, ff_mngsig, 8) != 0) av_log(avctx, AV_LOG_ERROR, "Invalid PNG signature (%d).\n", buf_size);
return -1; return AVERROR_INVALIDDATA;
}
bytestream2_init(&s->gb, buf + 8, buf_size - 8); bytestream2_init(&s->gb, buf + 8, buf_size - 8);
s->y = s->state = 0; s->y = s->state = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment