ffmpeg | branch: master | Vittorio Giovara <vittorio.giov...@gmail.com> | Mon 
Jan 12 23:55:45 2015 +0100| [1e763454322f7fbc7799f6009bf2e11d7a3b9821] | 
committer: Vittorio Giovara

png: improve signature check

Return proper error code, print an error message and add missing
parentheses.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e763454322f7fbc7799f6009bf2e11d7a3b9821
---

 libavcodec/pngdec.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index fa7f7cc..dec5bd5 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;

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

Reply via email to