PR #20977 opened by Zhao Zhili (quink)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20977
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20977.patch


>From 70e3fbb6484c171d0fa3b6d466865adc2c7332e6 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Tue, 28 Oct 2025 15:43:46 +0800
Subject: [PATCH 1/2] avformat/mov: relax check on proj box size

Pico VR adds a '\0' after projection_type (a real C string than
a fourcc). It's not strictly correct, but doesn't affect parsing.

[prji: Projection Information Box]
    position = 149574743
    size = 17
    version = 0
    flags = 0x000000
    projection_type = rect

Co-Authored-by: Keven Ma
Signed-off-by: Zhao Zhili <[email protected]>
(cherry picked from commit 0734d1c55aedaf2df4a51488f9b75e42daf9f707)
---
 libavformat/mov.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index b29c41a6b6..ea95d75155 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6844,15 +6844,17 @@ static int mov_read_vexu_proj(MOVContext *c, 
AVIOContext *pb, MOVAtom atom)
     st = c->fc->streams[c->fc->nb_streams - 1];
     sc = st->priv_data;
 
-    if (atom.size != 16) {
+    if (atom.size < 16) {
         av_log(c->fc, AV_LOG_ERROR, "Invalid size for proj box: %"PRIu64"\n", 
atom.size);
         return AVERROR_INVALIDDATA;
     }
 
     size = avio_rb32(pb);
-    if (size != 16) {
+    if (size < 16) {
         av_log(c->fc, AV_LOG_ERROR, "Invalid size for prji box: %d\n", size);
         return AVERROR_INVALIDDATA;
+    } else if (size > 16) {
+        av_log(c->fc, AV_LOG_WARNING, "Box has more bytes (%d) than prji box 
required (16) \n", size);
     }
 
     tag = avio_rl32(pb);
-- 
2.49.1


>From fa959739bfd391b37f6400cd2f84405896d086d3 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Wed, 8 Oct 2025 23:31:11 +0800
Subject: [PATCH 2/2] avformat/mov: fix missing video size when some decoders
 are disabled

Fix #20667

Signed-off-by: Zhao Zhili <[email protected]>
(cherry picked from commit 6b961f5963d8e362137702d38a744b45fba8ba3a)
---
 libavformat/mov.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index ea95d75155..f3945c2be2 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5242,16 +5242,22 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 #endif
     }
 
+#if CONFIG_H261_DECODER || CONFIG_H263_DECODER || CONFIG_MPEG4_DECODER
     switch (st->codecpar->codec_id) {
+#if CONFIG_H261_DECODER
     case AV_CODEC_ID_H261:
+#endif
+#if CONFIG_H263_DECODER
     case AV_CODEC_ID_H263:
+#endif
+#if CONFIG_MPEG4_DECODER
     case AV_CODEC_ID_MPEG4:
+#endif
         st->codecpar->width = 0; /* let decoder init width/height */
         st->codecpar->height= 0;
         break;
-    default:
-        break;
     }
+#endif
 
     // If the duration of the mp3 packets is not constant, then they could 
need a parser
     if (st->codecpar->codec_id == AV_CODEC_ID_MP3
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to