Commit db102ab6d4 for ffmpeg
commit db102ab6d49ad576a61f395b900d39706933022f
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Sun Nov 15 02:12:57 2026 +0100
avcodec/hevc: remove duplicate VPS release from set_sps()
82b7a19f4a1 and 8540c00f1bd fixed the same bug, each adding its own
av_refstruct_unref(&s->vps). The one from 8540c00f1bd runs before
pic_arrays_init() and so drops the active VPS when that fails for a
non-base layer, the next base layer frame then dereferences the NULL VPS
in ff_hevc_is_alpha_video().
Fixes: NULL pointer dereference
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 0934f64096..06688306bd 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -768,8 +768,6 @@ 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;