Commit 510dbddd52 for ffmpeg
commit 510dbddd523dd8aca25fdfe2d5e01803f4145bf1
Author: Martin Mirchev <mmirchev@comp.nus.edu.sg>
Date: Wed Oct 21 18:24:34 2026 +0800
avcodec/h264_parse: return SPS/PPS errors from avcC with explode
decode_extradata_ps_mp4() skips the retry with an escaped NAL when
AV_EF_EXPLODE is set, but then returns 0 regardless, so a parameter set
that fails to parse in avcC extradata is silently ignored exactly when
the caller asked for errors to be fatal. h264_decode_init() fails on
extradata errors only with explode, so avcodec_open2() succeeded with
-err_detect explode on avcC extradata with a broken SPS, and the
"Decoding sps %d from avcC failed" path was unreachable.
Return the error when explode is set.
Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>
diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
index c6f9b3cea7..80573ae251 100644
--- a/libavcodec/h264_parse.c
+++ b/libavcodec/h264_parse.c
@@ -424,7 +424,9 @@ static int decode_extradata_ps_mp4(const uint8_t *buf, int buf_size, H264ParamSe
int ret;
ret = decode_extradata_ps(buf, buf_size, ps, 1, logctx);
- if (ret < 0 && !(err_recognition & AV_EF_EXPLODE)) {
+ if (ret < 0 && (err_recognition & AV_EF_EXPLODE))
+ return ret;
+ if (ret < 0) {
GetByteContext gbc;
PutByteContext pbc;
uint8_t *escaped_buf;