[FFmpeg-devel] [PATCH] avcodec/pngdec: Mark damaged frames as finished

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Fri Nov 25 15:33:23 EET 2022


Fixes the deadlock reported in ticket #10071.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/pngdec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 8080094d65..f1cad26c52 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1362,8 +1362,10 @@ exit_loop:
         return 0;
     }
 
-    if (percent_missing(s) > avctx->discard_damaged_percentage)
-        return AVERROR_INVALIDDATA;
+    if (percent_missing(s) > avctx->discard_damaged_percentage) {
+        ret = AVERROR_INVALIDDATA;
+        goto fail;
+    }
 
     if (s->bits_per_pixel <= 4)
         handle_small_bpp(s, p);
-- 
2.34.1



More information about the ffmpeg-devel mailing list