[vlc-commits] [Git][videolan/vlc][master] 3 commits: mux: mpeg: add missing includes

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Aug 5 18:05:01 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b22e3720 by Alexandre Janniaux at 2024-08-05T17:22:33+00:00
mux: mpeg: add missing includes

Necessary because malloc and uint8_t are used.

- - - - -
5c24c232 by Alexandre Janniaux at 2024-08-05T17:22:33+00:00
mux: mpeg: remove useless include

- - - - -
3856f9fc by Alexandre Janniaux at 2024-08-05T17:22:33+00:00
mux: mpeg: guarantee non-overflow in the function

Fixes the bunch of warnings:

    In file included from ../../modules/mux/mpeg/tables.c:44:
    In function ‘bits_write’,
        inlined from ‘GetPMTmpeg4’ at ../../modules/mux/mpeg/tables.c:220:9,
        inlined from ‘BuildPMT’ at ../../modules/mux/mpeg/tables.c:478:13:
    ../../modules/mux/mpeg/bits.h:69:48: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
       69 |             p_buffer->p_data[p_buffer->i_data] |= p_buffer->i_mask;
          |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
    ../../modules/mux/mpeg/tables.c: In function ‘BuildPMT’:
    ../../modules/mux/mpeg/tables.c:181:13: note: at offset 4096 into destination object ‘iod’ of size 4096
      181 |     uint8_t iod[4096];
          |             ^~~
    In function ‘bits_write’,
        inlined from ‘GetPMTmpeg4’ at ../../modules/mux/mpeg/tables.c:220:9,
        inlined from ‘BuildPMT’ at ../../modules/mux/mpeg/tables.c:478:13:
    ../../modules/mux/mpeg/bits.h:69:48: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
       69 |             p_buffer->p_data[p_buffer->i_data] |= p_buffer->i_mask;
          |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
    ../../modules/mux/mpeg/tables.c: In function ‘BuildPMT’:
    ../../modules/mux/mpeg/tables.c:181:13: note: at offset 4096 into destination object ‘iod’ of size 4096
      181 |     uint8_t iod[4096];
          |             ^~~
    ...

- - - - -


2 changed files:

- modules/mux/mpeg/bits.h
- modules/mux/mpeg/tables.c


Changes:

=====================================
modules/mux/mpeg/bits.h
=====================================
@@ -21,6 +21,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include <stdint.h>
+#include <stdlib.h>
+
 typedef struct bits_buffer_s
 {
     int     i_size;
@@ -60,6 +63,9 @@ static inline void bits_align( bits_buffer_t *p_buffer )
 static inline void bits_write( bits_buffer_t *p_buffer,
                                int i_count, uint64_t i_bits )
 {
+    if (p_buffer->i_data + i_count < p_buffer->i_size)
+        return;
+
     while( i_count > 0 )
     {
         i_count--;


=====================================
modules/mux/mpeg/tables.c
=====================================
@@ -36,8 +36,6 @@
 # include <dvbpsi/dr.h>
 # include <dvbpsi/psi.h>
 
-#include "dvbpsi_compat.h"
-
 #include "streams.h"
 #include "tsutil.h"
 #include "tables.h"



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/befc924c225a39bf49f6e4ac09d1660013ce0676...3856f9fce93471c1d36bc6fdc34ad92484d79be2

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/befc924c225a39bf49f6e4ac09d1660013ce0676...3856f9fce93471c1d36bc6fdc34ad92484d79be2
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