avformat/mov: fix crash when stsz_sample_size is zero and sample_sizes is null

Co-Authored-by: James Almer <jamrial@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit cac5018eb9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 55da57f723)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Zhao Zhili
2025-11-25 13:00:34 +08:00
committed by Michael Niedermayer
parent 22ab1ba6bd
commit 4a2540316d

View File

@@ -5033,7 +5033,8 @@ static int sanity_checks(void *log_obj, MOVStreamContext *sc, int index)
{
if ((sc->chunk_count && (!sc->stts_count || !sc->stsc_count ||
(!sc->sample_size && !sc->sample_count))) ||
(!sc->chunk_count && sc->sample_count)) {
(sc->sample_count && (!sc->chunk_count ||
(!sc->sample_size && !sc->sample_sizes)))) {
av_log(log_obj, AV_LOG_ERROR, "stream %d, missing mandatory atoms, broken header\n",
index);
return 1;