[vlc-commits] [Git][videolan/vlc][master] 2 commits: dvbsub: avoid calling realloc_or_free() with 0 size

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Aug 20 08:09:56 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
f428d4b9 by Steve Lhomme at 2026-08-20T07:58:28+00:00
dvbsub: avoid calling realloc_or_free() with 0 size

It should free the pointer but it doesn't (yet).

Ref. #30051

- - - - -
453f441b by Steve Lhomme at 2026-08-20T07:58:28+00:00
dvbsub: do not use realloc_or_free on always NULL pointer

p_region->p_object_defs is always NULL when reaching this code.
This was already the case before d5fb042e7d5a1d7ad013f43dc0cc0790902477f2.

- - - - -


1 changed file:

- modules/codec/dvbsub.c


Changes:

=====================================
modules/codec/dvbsub.c
=====================================
@@ -965,7 +965,7 @@ static void decode_region_composition( decoder_t *p_dec, bs_t *s, uint16_t i_seg
         }
 
         size_t i_alloc;
-        if( ckd_mul( &i_alloc, i_width, i_height ) )
+        if( ckd_mul( &i_alloc, i_width, i_height ) || i_alloc == 0 )
         {
             free( p_region->p_pixbuf );
             p_region->p_pixbuf = NULL;
@@ -1011,8 +1011,7 @@ static void decode_region_composition( decoder_t *p_dec, bs_t *s, uint16_t i_seg
     else
         max_object_defs = (i_segment_length - i_processed_length) / 6;
     p_region->i_object_defs = 0;
-    p_region->p_object_defs = realloc_or_free( p_region->p_object_defs,
-                                               max_object_defs * sizeof(dvbsub_objectdef_t) );
+    p_region->p_object_defs = malloc( max_object_defs * sizeof(dvbsub_objectdef_t) );
     if( !p_region->p_object_defs )
         return;
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e9da6428d1d904ebcd9defa2ad70adc93b88ce15...453f441b1c730487dd6a6cc9b9d0a08df3e794b1

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e9da6428d1d904ebcd9defa2ad70adc93b88ce15...453f441b1c730487dd6a6cc9b9d0a08df3e794b1
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