[vlc-commits] [Git][videolan/vlc][master] 2 commits: demux: avi: add AVI_ChunkInit
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Jul 30 06:06:47 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
6fb88161 by François Cartegnie at 2025-07-30T05:22:53+00:00
demux: avi: add AVI_ChunkInit
- - - - -
08e09996 by François Cartegnie at 2025-07-30T05:22:53+00:00
demux: avi: fix potential leak reparsing for index
refs #29225
- - - - -
3 changed files:
- modules/demux/avi/avi.c
- modules/demux/avi/libavi.c
- modules/demux/avi/libavi.h
Changes:
=====================================
modules/demux/avi/avi.c
=====================================
@@ -3034,6 +3034,7 @@ static void AVI_ExtractSubtitle( demux_t *p_demux,
p_indx = AVI_ChunkFind( p_strl, AVIFOURCC_indx, 0, false );
avi_chunk_t ck;
+ AVI_ChunkInit( &ck );
int64_t i_position;
unsigned i_size;
if( p_indx )
@@ -3045,6 +3046,7 @@ static void AVI_ExtractSubtitle( demux_t *p_demux,
AVI_ChunkRead( p_demux->s, &ck, NULL ) ||
ck.common.i_chunk_fourcc != AVIFOURCC_indx )
goto exit;
+
p_indx = &ck.indx;
}
@@ -3147,8 +3149,7 @@ exit:
else
msg_Warn( p_demux, "Failed to load an embedded subtitle" );
- if( p_indx == &ck.indx )
- AVI_ChunkClean( p_demux->s, &ck );
+ AVI_ChunkClean( p_demux->s, &ck );
}
static avi_track_t * AVI_GetVideoTrackForXsub( demux_sys_t *p_sys )
=====================================
modules/demux/avi/libavi.c
=====================================
@@ -63,7 +63,7 @@ static int AVI_ChunkReadCommon( stream_t *s, avi_chunk_t *p_chk,
{
const uint8_t *p_peek;
- memset( p_chk, 0, sizeof( avi_chunk_t ) );
+ AVI_ChunkInit( p_chk );
const uint64_t i_pos = vlc_stream_Tell( s );
if( vlc_stream_Peek( s, &p_peek, 8 ) < 8 )
@@ -1060,11 +1060,16 @@ void AVI_ChunkClean( stream_t *s,
msg_Warn( s, "unknown chunk: %4.4s (not unloaded)",
(char*)&p_chk->common.i_chunk_fourcc );
}
- p_chk->common.p_first = NULL;
+ AVI_ChunkInit( p_chk );
return;
}
+void AVI_ChunkInit( avi_chunk_t *p_chk )
+{
+ memset( p_chk, 0, sizeof(*p_chk) );
+}
+
static void AVI_ChunkDumpDebug_level( vlc_object_t *p_obj,
avi_chunk_t *p_chk, unsigned i_level )
{
=====================================
modules/demux/avi/libavi.h
=====================================
@@ -253,6 +253,7 @@ int AVI_ChunkRead( stream_t *,
avi_chunk_t *p_chk,
avi_chunk_t *p_father );
void AVI_ChunkClean( stream_t *, avi_chunk_t * );
+void AVI_ChunkInit( avi_chunk_t * );
int AVI_ChunkCount_( avi_chunk_t *, vlc_fourcc_t, bool );
void *AVI_ChunkFind_ ( avi_chunk_t *, vlc_fourcc_t, int, bool );
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f6320508284a455fe548ef1ff2f93aa5ea09c986...08e0999642c6435ce39a94d56969e3b4814801ee
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f6320508284a455fe548ef1ff2f93aa5ea09c986...08e0999642c6435ce39a94d56969e3b4814801ee
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