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 <zhilizhao@tencent.com>
This commit is contained in:
Zhao Zhili
2026-03-20 10:38:19 +08:00
parent eadce30402
commit 163b9b6c7e

View File

@@ -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);