Skip to content

Commit 56b2166

Browse files
committed
caf: Reject samples without samplerate
Since the spec mandates it CVE-2019-14498
1 parent bbbdb83 commit 56b2166

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/demux/caf.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,11 @@ static int ReadDescChunk( demux_t *p_demux )
505505
return VLC_EGENERIC;
506506

507507
p_sys->fmt.audio.i_rate = (unsigned int)lround( d_rate );
508+
if( !p_sys->fmt.audio.i_rate )
509+
{
510+
msg_Err( p_demux, "Sample rate must be non-zero" );
511+
return VLC_EGENERIC;
512+
}
508513
p_sys->fmt.audio.i_channels = i_channels_per_frame;
509514
p_sys->fmt.audio.i_bytes_per_frame = i_bytes_per_packet; /* "mBytesPerPacket" in Apple parlance */
510515
p_sys->fmt.audio.i_frame_length = i_frames_per_packet; /* "mFramesPerPacket" in Apple parlance */
@@ -884,7 +889,7 @@ static int Open( vlc_object_t *p_this )
884889
i_idx++;
885890
}
886891

887-
if ( !p_sys->i_data_offset || p_sys->fmt.i_cat != AUDIO_ES ||
892+
if ( !p_sys->i_data_offset || p_sys->fmt.i_cat != AUDIO_ES || !p_sys->fmt.audio.i_rate ||
888893
( NeedsPacketTable( p_sys ) && !p_sys->packet_table.i_descriptions_start ))
889894
{
890895
msg_Err( p_demux, "Did not find all necessary chunks." );

0 commit comments

Comments
 (0)