meta_engine: taglib: restrict unlimited reads on streams
authorFrançois Cartegnie <fcvlcdev@free.fr>
Mon, 10 Aug 2020 12:55:02 +0000 (14:55 +0200)
committerSebastian Ramacher <sramacher@debian.org>
Tue, 14 Jan 2025 22:09:47 +0000 (23:09 +0100)
taglib reads unlimited if no IDv3 or MPEG header is found at the
beginning.

(cherry picked from commit 8ec8b0d2add84b6d6b0c043e1c4f241998915ecd) (rebased)
rebased:
- only used with Taglib 1.11+ which is not always the case with 3.0

Gbp-Pq: Name 0041-meta_engine-taglib-restrict-unlimited-reads-on-strea.patch

modules/meta_engine/taglib.cpp

index a52c67c928fda5a37e70cb9a79b613a4d37d42f5..0b7b5820fc7bb60abfd579a90a8d3e6e526dab39 100644 (file)
@@ -946,7 +946,14 @@ static int ReadMeta( vlc_object_t* p_this)
         p_stream = p_filter;
 
     VlcIostream s( p_stream );
-    f = FileRef( &s );
+#ifndef VLC_PATCHED_TAGLIB_ID3V2_READSTYLE
+    uint64_t dummy;
+    if( vlc_stream_GetSize( p_stream, &dummy ) != VLC_SUCCESS )
+        s.setMaxSequentialRead( 2048 );
+    else
+        s.setMaxSequentialRead( 1024 * 2048 );
+#endif
+    f = FileRef( &s, false, AudioProperties::ReadStyle::Fast );
 #else // !TAGLIB_VERSION_1_11
     char *psz_path = vlc_uri2path( psz_uri );
     free( psz_uri );