[FFmpeg-cvslog] lavc/pngdec: return meaningful error codes

Stefano Sabatini git at videolan.org
Tue Jun 25 21:32:31 CEST 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Tue Jun 25 10:02:22 2013 +0200| [0a3589bf2f0a23b0eb68664fbb00078abe882a88] | committer: Stefano Sabatini

lavc/pngdec: return meaningful error codes

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

 libavcodec/pngdec.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index c1fc606..1358ac5 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -368,8 +368,8 @@ static int png_decode_idat(PNGDecContext *s, int length)
     while (s->zstream.avail_in > 0) {
         ret = inflate(&s->zstream, Z_PARTIAL_FLUSH);
         if (ret != Z_OK && ret != Z_STREAM_END) {
-            av_log(s->avctx, AV_LOG_ERROR, "inflate returned %d\n", ret);
-            return -1;
+            av_log(s->avctx, AV_LOG_ERROR, "inflate returned error %d\n", ret);
+            return AVERROR_EXTERNAL;
         }
         if (s->zstream.avail_out == 0) {
             if (!(s->state & PNG_ALLIMAGE)) {
@@ -519,7 +519,7 @@ static int decode_frame(AVCodecContext *avctx,
     if (sig != PNGSIG &&
         sig != MNGSIG) {
         av_log(avctx, AV_LOG_ERROR, "Missing png signature\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
 
     s->y = s->state = 0;
@@ -530,8 +530,8 @@ static int decode_frame(AVCodecContext *avctx,
     s->zstream.opaque = NULL;
     ret = inflateInit(&s->zstream);
     if (ret != Z_OK) {
-        av_log(avctx, AV_LOG_ERROR, "inflateInit returned %d\n", ret);
-        return -1;
+        av_log(avctx, AV_LOG_ERROR, "inflateInit returned error %d\n", ret);
+        return AVERROR_EXTERNAL;
     }
     for (;;) {
         if (bytestream2_get_bytes_left(&s->gb) <= 0) {
@@ -859,7 +859,7 @@ static int decode_frame(AVCodecContext *avctx,
     return ret;
  fail:
     av_dict_free(&metadata);
-    ret = -1;
+    ret = AVERROR_INVALIDDATA;
     goto the_end;
 }
 



More information about the ffmpeg-cvslog mailing list