From 4a2540316dd4bbcf1d54a67eb0a20eeefcb016b0 Mon Sep 17 00:00:00 2001 From: Zhao Zhili Date: Tue, 25 Nov 2025 13:00:34 +0800 Subject: [PATCH] avformat/mov: fix crash when stsz_sample_size is zero and sample_sizes is null Co-Authored-by: James Almer Signed-off-by: Zhao Zhili (cherry picked from commit cac5018eb9278263e76ccc2891509ed662474853) Signed-off-by: Michael Niedermayer (cherry picked from commit 55da57f72377d4d6de5b80655614fc0161c0a0b0) Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 5172687406..90cc8b523b 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -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;