From 163b9b6c7ef66428f06f197ee56395f832545816 Mon Sep 17 00:00:00 2001 From: Zhao Zhili Date: Fri, 20 Mar 2026 10:38:19 +0800 Subject: [PATCH] avformat/lcevc: return error when no valid NAL units are found ff_lcvec_parse_config_record() returns success before this patch when no IDR or NON_IDR NAL units are found. Signed-off-by: Zhao Zhili --- libavformat/lcevc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavformat/lcevc.c b/libavformat/lcevc.c index f6a5bf1aaa..85ea96d22e 100644 --- a/libavformat/lcevc.c +++ b/libavformat/lcevc.c @@ -183,6 +183,7 @@ int ff_lcvec_parse_config_record(LCEVCDecoderConfigurationRecord *lvcc, H2645Packet h2645_pkt = { 0 }; AVIOContext *pb; int ret; + int found; if (size <= 0) return AVERROR_INVALIDDATA; @@ -221,6 +222,7 @@ int ff_lcvec_parse_config_record(LCEVCDecoderConfigurationRecord *lvcc, goto fail; /* look for IDR or NON_IDR */ + found = 0; for (int i = 0; i < h2645_pkt.nb_nals; i++) { const H2645NAL *nal = &h2645_pkt.nals[i]; @@ -229,9 +231,15 @@ int ff_lcvec_parse_config_record(LCEVCDecoderConfigurationRecord *lvcc, ret = write_nalu(lvcc, pb, nal); if (ret < 0) goto fail; + found = 1; } } + if (!found) { + ret = AVERROR_INVALIDDATA; + goto fail; + } + ret = 0; fail: ffio_close_null_buf(pb);