[vlc-commits] [Git][videolan/vlc][master] packetizer: hxxx: use size_t for the NAL size

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed May 13 07:43:52 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
eaa69c55 by Steve Lhomme at 2026-05-13T07:24:37+00:00
packetizer: hxxx: use size_t for the NAL size

And always use the same code to compare the used p_buffer and p.
It's already used to compare with i_nal_length_size.

Fixes #29659

- - - - -


1 changed file:

- modules/packetizer/hxxx_common.c


Changes:

=====================================
modules/packetizer/hxxx_common.c
=====================================
@@ -136,7 +136,7 @@ block_t *PacketizeXXC1( void *p_private, struct vlc_logger *logger,
     for( p = p_block->p_buffer; p < &p_block->p_buffer[p_block->i_buffer]; )
     {
         bool b_dummy;
-        int i_size = 0;
+        size_t i_size = 0;
         int i;
 
         if( &p_block->p_buffer[p_block->i_buffer] - p < i_nal_length_size )
@@ -147,17 +147,17 @@ block_t *PacketizeXXC1( void *p_private, struct vlc_logger *logger,
             i_size = (i_size << 8) | (*p++);
         }
 
-        if( i_size <= 0 ||
-            i_size > ( p_block->p_buffer + p_block->i_buffer - p ) )
+        if( i_size == 0 ||
+            i_size > (size_t)( &p_block->p_buffer[p_block->i_buffer] - p ) )
         {
-            vlc_error( logger, "Broken frame : size %d is too big", i_size );
+            vlc_error( logger, "Broken frame : size %zu is too big", i_size );
             break;
         }
 
         /* Convert AVC to AnnexB */
         block_t *p_nal;
         /* If data exactly match remaining bytes (1 NAL only or trailing one) */
-        if( i_size == p_block->p_buffer + p_block->i_buffer - p )
+        if( i_size == (size_t)( &p_block->p_buffer[p_block->i_buffer] - p ) )
         {
             p_block->i_buffer = i_size;
             p_block->p_buffer = p;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/eaa69c55aa708e33aff1571ca7e98449b9c35194

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/eaa69c55aa708e33aff1571ca7e98449b9c35194
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list