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


>From d366a45df09d4aa81862a286919d2fec966d5e94 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Tue, 28 Oct 2025 15:43:46 +0800
Subject: [PATCH 1/3] 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]>
---
 libavformat/mov.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 45c562cdc6..32c834d98d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6852,13 +6852,13 @@ 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;
     }
-- 
2.49.1


>From 6f23ab596bb128a8edf76b722928382ffe6b7bcc Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Tue, 28 Oct 2025 16:02:10 +0800
Subject: [PATCH 2/3] avformat/mov: check prji box version and flags

Signed-off-by: Zhao Zhili <[email protected]>
---
 libavformat/mov.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 32c834d98d..19f8677cab 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6869,8 +6869,13 @@ static int mov_read_vexu_proj(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
         return AVERROR_INVALIDDATA;
     }
 
-    avio_skip(pb, 1); // version
-    avio_skip(pb, 3); // flags
+     // version and flags, only support (0, 0)
+    unsigned n = avio_rl32(pb);
+    if (n != 0) {
+        av_log(c->fc, AV_LOG_ERROR, "prji version %u, flag %u are not 
supported\n",
+               n & 0xFF, n >> 8);
+        return AVERROR_PATCHWELCOME;
+    }
 
     tag = avio_rl32(pb);
     switch (tag) {
-- 
2.49.1


>From 0d7ce43e44f8dd7a2809eed6b73f7f5c17261042 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Tue, 28 Oct 2025 16:10:45 +0800
Subject: [PATCH 3/3] avformat/mov: log unknown tag via av_fourcc2str

Signed-off-by: Zhao Zhili <[email protected]>
---
 libavformat/mov.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 19f8677cab..9452f94afc 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6667,7 +6667,8 @@ static int mov_read_pack(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
                 // This means value will be set in another layer
                 break;
             default:
-                av_log(c->fc, AV_LOG_WARNING, "Unknown tag in pkin: 0x%08X\n", 
tag);
+                av_log(c->fc, AV_LOG_WARNING, "Unknown tag in pkin: %s\n",
+                       av_fourcc2str(tag));
                 avio_skip(pb, size - 8);
                 break;
             }
@@ -6675,7 +6676,8 @@ static int mov_read_pack(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
             break;
         }
         default:
-            av_log(c->fc, AV_LOG_WARNING, "Unknown tag in pack: 0x%08X\n", 
tag);
+            av_log(c->fc, AV_LOG_WARNING, "Unknown tag in pack: %s\n",
+                   av_fourcc2str(tag));
             avio_skip(pb, size - 8);
             break;
         }
@@ -7051,7 +7053,8 @@ static int mov_read_eyes(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
             break;
         }
         default:
-            av_log(c->fc, AV_LOG_WARNING, "Unknown tag in eyes: 0x%08X\n", 
tag);
+            av_log(c->fc, AV_LOG_WARNING, "Unknown tag in eyes: %s\n",
+                   av_fourcc2str(tag));
             avio_skip(pb, size - 8);
             break;
         }
@@ -7128,7 +7131,8 @@ static int mov_read_vexu(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
             break;
         }
         default:
-            av_log(c->fc, AV_LOG_WARNING, "Unknown tag in vexu: 0x%08X\n", 
tag);
+            av_log(c->fc, AV_LOG_WARNING, "Unknown tag in vexu: %s\n",
+                   av_fourcc2str(tag));
             avio_skip(pb, size - 8);
             break;
         }
-- 
2.49.1

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

Reply via email to