avformat/swfdec: Fix inflate() error code check
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 19 Aug 2016 08:28:22 +0000 (10:28 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 25 Aug 2016 01:29:35 +0000 (03:29 +0200)
Fixes infinite loop
Fixes endless.poc

Found-by: 连一汉 <lianyihan@360.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a453bbb68f3eec202673728988bba3bc76071761)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/swfdec.c

index fa2435e..c6f5fe6 100644 (file)
@@ -119,10 +119,10 @@ retry:
     z->avail_out = buf_size;
 
     ret = inflate(z, Z_NO_FLUSH);
-    if (ret < 0)
-        return AVERROR(EINVAL);
     if (ret == Z_STREAM_END)
         return AVERROR_EOF;
+    if (ret != Z_OK)
+        return AVERROR(EINVAL);
 
     if (buf_size - z->avail_out == 0)
         goto retry;