[vlc-commits] [Git][videolan/vlc][master] 2 commits: stream_extractor: set correct offset on read failure

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Sep 3 11:36:37 UTC 2023



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
9f160402 by Francois Cartegnie at 2023-09-03T11:22:04+00:00
stream_extractor: set correct offset on read failure

- - - - -
228df81e by Francois Cartegnie at 2023-09-03T11:22:04+00:00
input: stream_extractor: no need for format string

- - - - -


2 changed files:

- modules/stream_extractor/archive.c
- src/input/stream_extractor.c


Changes:

=====================================
modules/stream_extractor/archive.c
=====================================
@@ -628,16 +628,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;
@@ -680,9 +680,13 @@ static int Seek( stream_extractor_t* p_extractor, uint64_t i_req )
 
             i_skip = i_req;
         }
-
-        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;


=====================================
src/input/stream_extractor.c
=====================================
@@ -106,7 +106,8 @@ StreamExtractorCreateMRL( char const* base, char const* subentry )
     if( !strstr( base, "#" ) )
         vlc_memstream_putc( &buffer, '#' );
 
-    vlc_memstream_printf( &buffer, "!/%s", escaped );
+    vlc_memstream_puts( &buffer, "!/" );
+    vlc_memstream_puts( &buffer, escaped );
 
     free( escaped );
     return vlc_memstream_close( &buffer ) ? NULL : buffer.ptr;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b5f72f801b8e34a3d71360690d1ce9034db07fd5...228df81ea9955b903e9a32362906bdebcf64fe44

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b5f72f801b8e34a3d71360690d1ce9034db07fd5...228df81ea9955b903e9a32362906bdebcf64fe44
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