From 486837792aedcf9b600bc0d560620cb996298af1 Mon Sep 17 00:00:00 2001
From: Dale Curtis <dalecurtis@chromium.org>
Date: Tue, 7 Jan 2025 00:11:49 +0000
Subject: [PATCH] [h264] Make slice header parse errors fatal under
 AV_EF_EXPLODE

This fixes timeout issues with https://crbug.com/383814043 and
seems like it was intended since the line emits an error log.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
---
 libavcodec/h264dec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 8feb5558aa..45ebe2656d 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -742,8 +742,10 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
                    nal->type, nal->size_bits);
         }
 
-        if (err < 0) {
+        if (err < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) {
             av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header error\n");
+            ret = err;
+            goto end;
         }
     }
 
-- 
2.47.1.613.gc27f4b7a9f-goog

