[vlc-commits] [Git][videolan/vlc][3.0.x] 6 commits: demux: caf: use size_t
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Aug 21 12:35:01 UTC 2026
Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
8d626572 by Alexandre Janniaux at 2026-08-21T12:21:12+00:00
demux: caf: use size_t
(cherry picked from commit 961e8ce906bcf4431219866091338764578656ed)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
926bd7ad by Steve Lhomme at 2026-08-21T12:21:12+00:00
demux: caf: free the previous extra data before allocating a new buffer
As we read chunks and keep the information from the last one, the
format may have already been allocated before.
Fixes #29670
(cherry picked from commit 6c93300e9d31aa39165fd81134bc6e3899d1910d)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
a04afb11 by Steve Lhomme at 2026-08-21T12:21:12+00:00
demux: caf: consider the extra data allocation failed when the size is not 0
Ref. #29670
(cherry picked from commit bd20ea96e72d4dd2642046ffbdbc13937a4f848b)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
341b8c86 by Steve Lhomme at 2026-08-21T12:21:12+00:00
demux: caf: don't allocate a size of 0
(cherry picked from commit cdd31f628acbd18775005de24b746074679340b0)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
b8eb7bfe by Steve Lhomme at 2026-08-21T12:21:12+00:00
demux: caf: avoid memcpy() with 0 size
(cherry picked from commit b48701c110e2bf974acb66aad9fb9da006106355)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
44df582b by Steve Lhomme at 2026-08-21T12:21:12+00:00
demux: caf: reduce scope of local variable
(cherry picked from commit 03e0366f5e7135792991ae80179bc33e99b0a9ab)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
1 changed file:
- modules/demux/caf.c
Changes:
=====================================
modules/demux/caf.c
=====================================
@@ -535,9 +535,9 @@ static int ProcessALACCookie( demux_t *p_demux, const uint8_t *p, uint64_t i_siz
{
demux_sys_t *p_sys = p_demux->p_sys;
- const unsigned int kALAC_NEW_KUKI_SIZE = 24;
- const unsigned int kALAC_LIB_REQ_KUKI_SIZE = 36;
- int i_extra;
+ const size_t kALAC_NEW_KUKI_SIZE = 24;
+ const size_t kALAC_LIB_REQ_KUKI_SIZE = 36;
+ size_t i_extra;
if( i_size == kALAC_NEW_KUKI_SIZE || i_size == kALAC_LIB_REQ_KUKI_SIZE )
{
@@ -546,25 +546,25 @@ static int ProcessALACCookie( demux_t *p_demux, const uint8_t *p, uint64_t i_siz
else
{
msg_Warn( p_demux, "Unknown alac magic cookie. Passing it on to the decoder as is and hoping for the best." );
- i_extra = ( int )i_size;
+ i_extra = i_size;
}
+ free(p_sys->fmt.p_extra);
p_sys->fmt.i_extra = i_extra;
- p_sys->fmt.p_extra = malloc( i_extra );
+ p_sys->fmt.p_extra = i_extra == 0 ? NULL : malloc( i_extra );
- if( !p_sys->fmt.p_extra )
+ if( i_extra && !p_sys->fmt.p_extra )
return VLC_ENOMEM;
- uint8_t *p_extra = ( uint8_t * )p_sys->fmt.p_extra;
-
if( i_size == kALAC_NEW_KUKI_SIZE )
{
+ uint8_t *p_extra = ( uint8_t * )p_sys->fmt.p_extra;
SetDWBE( p_extra, 36 );
memcpy( p_extra + 4, "alac", 4 );
SetDWBE( p_extra + 8, 0 );
memcpy( p_extra + 12, p, 24 );
}
- else
+ else if (i_size != 0)
{
memcpy( p_sys->fmt.p_extra, p, i_size );
}
@@ -678,15 +678,18 @@ aac_kuki_finish:
i_offset = 0;
}
- p_sys->fmt.i_extra = (int)i_kuki_size;
- p_sys->fmt.p_extra = malloc( i_kuki_size );
+ free(p_sys->fmt.p_extra);
+ p_sys->fmt.i_extra = i_kuki_size;
+ p_sys->fmt.p_extra = i_kuki_size == 0 ? NULL : malloc( i_kuki_size );
- if( !p_sys->fmt.p_extra )
+ if( i_kuki_size && !p_sys->fmt.p_extra )
{
return VLC_ENOMEM;
}
-
- memcpy( p_sys->fmt.p_extra, p + i_offset, i_kuki_size );
+ if ( i_kuki_size )
+ {
+ memcpy( p_sys->fmt.p_extra, p + i_offset, i_kuki_size );
+ }
return VLC_SUCCESS;
}
@@ -720,14 +723,18 @@ static int ReadKukiChunk( demux_t *p_demux, uint64_t i_size )
}
else if( p_sys->fmt.i_codec != 0 )
{
- p_sys->fmt.i_extra = (int)i_size;
- p_sys->fmt.p_extra = malloc( i_size );
+ free(p_sys->fmt.p_extra);
+ p_sys->fmt.i_extra = i_size;
+ p_sys->fmt.p_extra = i_size == 0 ? NULL : malloc( i_size );
- if( !p_sys->fmt.p_extra )
+ if( i_size && !p_sys->fmt.p_extra )
{
return VLC_ENOMEM;
}
- memcpy( p_sys->fmt.p_extra, p_peek, p_sys->fmt.i_extra );
+ if ( i_size != 0)
+ {
+ memcpy( p_sys->fmt.p_extra, p_peek, p_sys->fmt.i_extra );
+ }
}
return VLC_SUCCESS;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/701407497457c444303f22e4f11220e178ab471c...44df582bc266b64d0f1048c9ffa3d96343215961
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/701407497457c444303f22e4f11220e178ab471c...44df582bc266b64d0f1048c9ffa3d96343215961
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