[vlc-commits] [Git][videolan/vlc][master] 2 commits: packetizer: mpeg4audio: don't allocate a size of 0

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri May 15 11:56:20 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
13fb40e5 by Steve Lhomme at 2026-05-15T11:45:48+00:00
packetizer: mpeg4audio: don't allocate a size of 0

Depending on the allocator it may return NULL or an allocated pointer.
In the former case b_latm_cfg is set to false, in the latter case b_latm_cfg is
set to true.

The code below may turn a b_latm_cfg to true, but if i_extra is not 0
which is not the case here.

The expected behavior is probably to have b_latm_cfg set to false if i_extra is 0.

Ref. #29831

- - - - -
88fb689e by Steve Lhomme at 2026-05-15T11:45:48+00:00
packetizer: mpeg4audio: remove unnecessary cast

Both variables are size_t since 48452d5a7cd86f7ba8a77f00525196f94b1e5622
and 03bba25b5d327f7f18c585eb49d57fe32f90d012.

- - - - -


1 changed file:

- modules/packetizer/mpeg4audio.c


Changes:

=====================================
modules/packetizer/mpeg4audio.c
=====================================
@@ -452,13 +452,13 @@ static int LOASParse(decoder_t *p_dec, uint8_t *p_buffer, int i_buffer)
 
         if (p_sys->i_channels && p_sys->i_rate && p_sys->i_frame_length > 0)
         {
-            if((size_t)p_dec->fmt_out.i_extra != st->i_extra ||
+            if(p_dec->fmt_out.i_extra != st->i_extra ||
                (p_dec->fmt_out.i_extra > 0 &&
                 memcmp(p_dec->fmt_out.p_extra, st->extra, st->i_extra)) )
             {
                 if(p_dec->fmt_out.i_extra)
                     free(p_dec->fmt_out.p_extra);
-                p_dec->fmt_out.p_extra = malloc(st->i_extra);
+                p_dec->fmt_out.p_extra = st->i_extra ? malloc(st->i_extra) : NULL;
                 if(p_dec->fmt_out.p_extra)
                 {
                     p_dec->fmt_out.i_extra = st->i_extra;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2e5dc285c093b84111ea1000bb5dd0810fa315cb...88fb689e7143258cb740aa02f484bc40187ba354

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2e5dc285c093b84111ea1000bb5dd0810fa315cb...88fb689e7143258cb740aa02f484bc40187ba354
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