From 8540c00f1bdbf85d62bfa521aa8ae8880a727fb1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 20 Oct 2026 15:57:12 +0200 Subject: [PATCH] avcodec/hevc: keep the active VPS when clearing a layer's SPS set_sps() with a NULL SPS released s->vps before returning, also when only a non-base layer was cleared while the base layer keeps decoding. The next base-layer frame then dereferenced the NULL VPS in ff_hevc_is_alpha_video(). Release s->vps only when a new SPS is installed alongside it. Assisted-by: Fairy Signed-off-by: Michael Niedermayer --- libavcodec/hevc/hevcdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 14fdadc7cc..f5f0cf7f10 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -768,6 +768,8 @@ static int set_sps(HEVCContext *s, HEVCLayerContext *l, const HEVCSPS *sps) if (!sps) return 0; + av_refstruct_unref(&s->vps); + ret = pic_arrays_init(l, sps); if (ret < 0) goto fail;