Commit 847acdff18 for ffmpeg
commit 847acdff187e6f2f1b725644ac9eabdea7aed9f2
Author: Nicholas Carlini <nicholas@carlini.com>
Date: Sat Sep 19 22:06:26 2026 +0200
avcodec/hevc: re-validate non-base layer SPS when the base SPS changes
Fixes: out of array access
Fixes: Ot8zjwCVrunh
Regression since: f926b6045522c5f9887a108f5d9b6ae017e9ba02
Found-by: Nicholas Carlini <nicholas@carlini.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index f5f0cf7f10..f1bd562291 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -3451,6 +3451,9 @@ static int hevc_frame_start(HEVCContext *s, HEVCLayerContext *l,
"Base/non-base layer SPS have unsupported parameter combination\n");
return AVERROR(ENOSYS);
}
+ } else {
+ for (int i = 1; i < FF_ARRAY_ELEMS(s->layers); i++)
+ set_sps(s, &s->layers[i], NULL);
}
ff_hevc_clear_refs(l);