[vlc-commits] [Git][videolan/vlc][3.0.x] 3 commits: taglib: limit the amount of data read at once

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Sep 10 07:41:53 UTC 2026



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
a5fbd6dd by Steve Lhomme at 2026-09-10T06:54:59+00:00
taglib: limit the amount of data read at once

The size of data in ByteVector is limited to unsigned int. We can't read more than that.
Very large values are likely bogus anyway.

Fixes #30094

(cherry picked from commit a074fac0cef39a7893448453f231d3120fd02db6)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
5c32ca2c by Steve Lhomme at 2026-09-10T06:54:59+00:00
taglib: add override on overridden methods

(cherry picked from commit e0d0d07b81c429771284d532f46270ca284fc173)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
66455a98 by Steve Lhomme at 2026-09-10T06:54:59+00:00
tablib: fix potential read overflow

length() returns a different type since ec29dfca1e59530dd412d779e0b045079b72ffb6.

(cherry picked from commit 4a956b129931934456dd1a88a0fbea0aeeeb8505)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -


1 changed file:

- modules/meta_engine/taglib.cpp


Changes:

=====================================
modules/meta_engine/taglib.cpp
=====================================
@@ -222,7 +222,7 @@ public:
         vlc_stream_Delete( m_stream );
     }
 
-    FileName name() const
+    FileName name() const override
     {
         // Taglib only cares about the file name part, so it doesn't matter
         // whether we include the mrl scheme or not
@@ -230,11 +230,17 @@ public:
     }
 
 #if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-    ByteVector readBlock(size_t length)
+    ByteVector readBlock(size_t length) override
 #else
-    ByteVector readBlock(ulong length)
+    ByteVector readBlock(ulong length) override
 #endif
     {
+        if (length > std::numeric_limits<unsigned int>::max())
+            // ByteVector can't hold more data than unsigned int size
+            // we can read less and provide what we got
+            // we can't return nothing in case it considers it's EOF, so read 16 KB
+            length = 1 << 14;
+
         if(m_borked || m_seqReadLength >= m_seqReadLimit)
             return {};
         ByteVector res(length, 0);
@@ -248,33 +254,33 @@ public:
         return res;
     }
 
-    void writeBlock(const ByteVector&)
+    void writeBlock(const ByteVector&) override
     {
         // Let's stay Read-Only for now
     }
 
 #if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-    void insert(const ByteVector&, offset_t, size_t)
+    void insert(const ByteVector&, offset_t, size_t) override
 #else
-    void insert(const ByteVector&, ulong, ulong)
+    void insert(const ByteVector&, ulong, ulong) override
 #endif
     {
     }
 
 #if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-    void removeBlock(offset_t, size_t)
+    void removeBlock(offset_t, size_t) override
 #else
-    void removeBlock(ulong, ulong)
+    void removeBlock(ulong, ulong) override
 #endif
     {
     }
 
-    bool readOnly() const
+    bool readOnly() const override
     {
         return true;
     }
 
-    bool isOpen() const
+    bool isOpen() const override
     {
         return true;
     }
@@ -285,19 +291,24 @@ public:
     }
 
 #if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-    void seek(offset_t offset, Position p)
+    void seek(offset_t offset, Position p) override
 #else
-    void seek(long offset, Position p)
+    void seek(long offset, Position p) override
 #endif
     {
         uint64_t pos = 0;
-        long len;
         switch (p)
         {
             case Current:
                 pos = m_previousPos;
                 break;
             case End:
+            {
+#if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
+                offset_t len;
+#else
+                long len;
+#endif
                 len = length();
                 if(len > -1)
                 {
@@ -309,6 +320,7 @@ public:
                     return;
                 }
                 break;
+            }
             default:
                 break;
         }
@@ -318,24 +330,24 @@ public:
         m_seqReadLength = 0;
     }
 
-    void clear()
+    void clear() override
     {
         return;
     }
 
 #if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-    offset_t tell() const
+    offset_t tell() const override
 #else
-    long tell() const
+    long tell() const override
 #endif
     {
         return m_previousPos;
     }
 
 #if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-    offset_t length()
+    offset_t length() override
 #else
-    long length()
+    long length() override
 #endif
     {
         uint64_t i_size;
@@ -345,9 +357,9 @@ public:
     }
 
 #if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-    void truncate(offset_t)
+    void truncate(offset_t) override
 #else
-    void truncate(long)
+    void truncate(long) override
 #endif
     {
     }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4d08fe2a37bfba5ea223758ecd033b15ca53400d...66455a98c8c515796b4a192acaa125c5d68c76c8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4d08fe2a37bfba5ea223758ecd033b15ca53400d...66455a98c8c515796b4a192acaa125c5d68c76c8
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list