[vlc-commits] [Git][videolan/vlc][3.0.x] 3 commits: archive: Add support for RAR 5.0 format

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Sep 30 09:43:12 UTC 2024



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


Commits:
64888ed1 by Johan Gunnarsson at 2024-09-26T15:55:27+02:00
archive: Add support for RAR 5.0 format

libarchive 3.4.0 adds support for RAR 5.0. See
https://www.rarlab.com/technote.htm#rarsign for description of signatures.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 059f6f5690005853f3e3160f5f896301b2f52ecd)

- - - - -
5da01cd0 by Steve Lhomme at 2024-09-26T15:55:27+02:00
archive: fix the type used for libarchive_skip_cb

It is not using off_t.

(cherry picked from commit 5da9f85b186a69e5b64d83470b32b7fd19dbf943)

- - - - -
f94f0a5f by François Cartegnie at 2024-09-26T15:55:27+02:00
stream_extractor: set correct offset on read failure

(cherry picked from commit 9f160402e3ea835f1d242e8ca5af89c57a3a2583)

- - - - -


1 changed file:

- modules/stream_extractor/archive.c


Changes:

=====================================
modules/stream_extractor/archive.c
=====================================
@@ -131,7 +131,7 @@ static int libarchive_jump_cb( libarchive_t* p_arc, void* p_obj_current,
 
 
 static la_int64_t libarchive_skip_cb( libarchive_t* p_arc, void* p_obj,
-  off_t i_request )
+                                      la_int64_t i_request )
 {
     VLC_UNUSED( p_arc );
 
@@ -454,7 +454,10 @@ static int probe( stream_t* source )
     } const magicbytes[] = {
         /* keep heaviest at top */
         { 257, 5, "ustar" },              //TAR
-        { 0,   7, "Rar!\x1A\x07" },       //RAR
+#if ARCHIVE_VERSION_NUMBER >= 3004000
+        { 0,   8, "Rar!\x1A\x07\x01" },   //RAR5.0
+#endif
+        { 0,   7, "Rar!\x1A\x07" },       //RAR4.x
         { 0,   6, "7z\xBC\xAF\x27\x1C" }, //7z
         { 0,   4, "xar!" },               //XAR
         { 0,   4, "PK\x03\x04" },         //ZIP
@@ -606,16 +609,16 @@ eof:
     return 0;
 }
 
-static int archive_skip_decompressed( stream_extractor_t* p_extractor, uint64_t i_skip )
+static int archive_skip_decompressed( stream_extractor_t* p_extractor, uint64_t *pi_skip )
 {
-    while( i_skip )
+    while( *pi_skip )
     {
-        ssize_t i_read = Read( p_extractor, NULL, i_skip );
+        ssize_t i_read = Read( p_extractor, NULL, *pi_skip );
 
         if( i_read < 1 )
             return VLC_EGENERIC;
 
-        i_skip -= i_read;
+        *pi_skip -= i_read;
     }
 
     return VLC_SUCCESS;
@@ -660,9 +663,13 @@ static int Seek( stream_extractor_t* p_extractor, uint64_t i_req )
             i_skip = i_req;
             i_offset = 0;
         }
-
-        if( archive_skip_decompressed( p_extractor, i_skip ) )
-            msg_Dbg( p_extractor, "failed to skip to seek position" );
+        if( archive_skip_decompressed( p_extractor, &i_skip ) )
+        {
+            msg_Warn( p_extractor, "failed to skip to seek position %" PRIu64 "/%" PRId64,
+                      i_req, archive_entry_size( p_sys->p_entry ) );
+            p_sys->i_offset += i_skip;
+            return VLC_EGENERIC;
+        }
     }
 
     p_sys->i_offset = i_req;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/47e6c1b726b22afb53a0762506864650ca1a2d33...f94f0a5f979668fee7b0d2e8bb9cc89152135eac

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/47e6c1b726b22afb53a0762506864650ca1a2d33...f94f0a5f979668fee7b0d2e8bb9cc89152135eac
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list