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

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Aug 21 13:06:19 UTC 2026



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


Commits:
3409e57d by Steve Lhomme at 2026-08-21T12:57:17+00:00
stream_filter: hds: do not read data for unknown size stream

stream_Size() returns 0 when the size is unknown.

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

- - - - -
1482b100 by Steve Lhomme at 2026-08-21T12:57:17+00:00
stream_filter: hds: fix indentation

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

- - - - -
58c0b80d by Steve Lhomme at 2026-08-21T12:57:17+00:00
stream_filter: hds: do sanity check before casting

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

- - - - -


1 changed file:

- modules/stream_filter/hds/hds.c


Changes:

=====================================
modules/stream_filter/hds/hds.c
=====================================
@@ -809,13 +809,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 )
@@ -1144,25 +1143,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( p_this, "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( p_this, hds_stream,
-                                     data, data + read );
-                vlc_mutex_unlock( & hds_stream->abst_lock );
-                maintain_live_chunks( p_this, hds_stream );
-            }
+                uint8_t* data = malloc( size );
+                int read = vlc_stream_Read( download_stream, data,
+                                        size );
+                if( read < size )
+                {
+                    msg_Err( p_this, "Requested %"PRIi64" bytes, "  \
+                             "but only got %d", size, read );
 
-            free( data );
+                }
+                else
+                {
+                    vlc_mutex_lock( & hds_stream->abst_lock );
+                    parse_BootstrapData( p_this, hds_stream,
+                                         data, data + read );
+                    vlc_mutex_unlock( & hds_stream->abst_lock );
+                    maintain_live_chunks( p_this, hds_stream );
+                }
+
+                free( data );
+            }
 
             vlc_stream_Delete( download_stream );
         }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/44df582bc266b64d0f1048c9ffa3d96343215961...58c0b80dab21ee7203d998066520772a3fc8c1d4

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/44df582bc266b64d0f1048c9ffa3d96343215961...58c0b80dab21ee7203d998066520772a3fc8c1d4
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