[vlc-commits] [Git][videolan/vlc][master] 3 commits: stream_filter: hds: do not read data for unknown size stream

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Aug 13 08:30:35 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
a679fb40 by Steve Lhomme at 2026-08-13T08:20:42+00:00
stream_filter: hds: do not read data for unknown size stream

stream_Size() returns 0 when the size is unknown.

- - - - -
8da32c61 by Steve Lhomme at 2026-08-13T08:20:42+00:00
stream_filter: hds: fix indentation

- - - - -
f262259f by Steve Lhomme at 2026-08-13T08:20:42+00:00
stream_filter: hds: do sanity check before casting

- - - - -


1 changed file:

- modules/stream_filter/hds/hds.c


Changes:

=====================================
modules/stream_filter/hds/hds.c
=====================================
@@ -810,13 +810,12 @@ static uint8_t* download_chunk( stream_t *s,
     free( fragment_url );
 
     int64_t size = stream_Size( download_stream );
-    chunk->data_len = (uint32_t) size;
-
     if( size > MAX_REQUEST_SIZE )
     {
         msg_Err(s, "Strangely-large chunk of %"PRIi64" Bytes", size );
         return NULL;
     }
+    chunk->data_len = (uint32_t) size;
 
     uint8_t* data = malloc( size );
     if( ! data )
@@ -1149,25 +1148,32 @@ static void* live_thread( void* p )
         else
         {
             int64_t size = stream_Size( download_stream );
-            uint8_t* data = malloc( size );
-            int read = vlc_stream_Read( download_stream, data,
-                                    size );
-            if( read < size )
+            if( size == 0 )
             {
-                msg_Err( s, "Requested %"PRIi64" bytes, "  \
-                         "but only got %d", size, read );
-
+                msg_Err( s, "Unknown stream size for %s", abst_url );
             }
             else
             {
-                vlc_mutex_lock( & hds_stream->abst_lock );
-                parse_BootstrapData( VLC_OBJECT(s), hds_stream,
-                                     data, data + read );
-                vlc_mutex_unlock( & hds_stream->abst_lock );
-                maintain_live_chunks( s, hds_stream );
-            }
+                uint8_t* data = malloc( size );
+                int read = vlc_stream_Read( download_stream, data,
+                                        size );
+                if( read < size )
+                {
+                    msg_Err( s, "Requested %"PRIi64" bytes, "  \
+                             "but only got %d", size, read );
 
-            free( data );
+                }
+                else
+                {
+                    vlc_mutex_lock( & hds_stream->abst_lock );
+                    parse_BootstrapData( VLC_OBJECT(s), hds_stream,
+                                         data, data + read );
+                    vlc_mutex_unlock( & hds_stream->abst_lock );
+                    maintain_live_chunks( s, hds_stream );
+                }
+
+                free( data );
+            }
 
             vlc_stream_Delete( download_stream );
         }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/444196dd70992f3c2d6b495731460fb32a47660d...f262259f97d8676973862675cbb4858b4feea8bf

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/444196dd70992f3c2d6b495731460fb32a47660d...f262259f97d8676973862675cbb4858b4feea8bf
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