Commit f0b998ef authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use calloc() instead of malloc() - fixes integer overflow...

...assuming you have non-buggy calloc() implementation.

Pointed-out-by: Drew Yao
Signed-off-by: default avatarRémi Denis-Courmont <rem@videolan.org>
parent 13836da7
...@@ -1082,18 +1082,16 @@ static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num ) ...@@ -1082,18 +1082,16 @@ static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num )
tk->i_subpackets = tk->i_subpackets =
i_subpacket_h * i_frame_size / tk->i_subpacket_size; i_subpacket_h * i_frame_size / tk->i_subpacket_size;
tk->p_subpackets = tk->p_subpackets =
malloc( tk->i_subpackets * sizeof(block_t *) ); calloc( tk->i_subpackets, sizeof(block_t *) );
} }
else if( fmt.i_codec == VLC_FOURCC('2','8','_','8') ) else if( fmt.i_codec == VLC_FOURCC('2','8','_','8') )
{ {
tk->i_subpackets = tk->i_subpackets =
i_subpacket_h * i_frame_size / tk->i_coded_frame_size; i_subpacket_h * i_frame_size / tk->i_coded_frame_size;
tk->p_subpackets = tk->p_subpackets =
malloc( tk->i_subpackets * sizeof(block_t *) ); calloc( tk->i_subpackets, sizeof(block_t *) );
} }
for( i = 0; i < tk->i_subpackets; i++ ) tk->p_subpackets[i] = NULL;
tk->p_es = es_out_Add( p_demux->out, &fmt ); tk->p_es = es_out_Add( p_demux->out, &fmt );
TAB_APPEND( p_sys->i_track, p_sys->track, tk ); TAB_APPEND( p_sys->i_track, p_sys->track, tk );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment