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

caf: fix error handling / integer overflow

parent d23a1c7c
...@@ -277,7 +277,11 @@ static int FrameSpanAddDescription( demux_t *p_demux, uint64_t i_desc_offset, fr ...@@ -277,7 +277,11 @@ static int FrameSpanAddDescription( demux_t *p_demux, uint64_t i_desc_offset, fr
} }
const uint8_t *p_peek; const uint8_t *p_peek;
uint32_t i_peek_len = stream_Peek( p_demux->s, &p_peek, 2 * 10 ); /* Peeking the maximum number of bytes that two 64 bit numbers could use (( 64 + 6 ) / 7 = 10 ). */ int i_peek_len = stream_Peek( p_demux->s, &p_peek, 2 * 10 );
/* Peeking the maximum number of bytes that two 64 bit numbers could use
* (( 64 + 6 ) / 7 = 10). */
if( i_peek_len < 0 )
i_peek_len = 0;
if( p_sys->fmt.audio.i_bytes_per_frame ) if( p_sys->fmt.audio.i_bytes_per_frame )
{ {
...@@ -302,7 +306,7 @@ static int FrameSpanAddDescription( demux_t *p_demux, uint64_t i_desc_offset, fr ...@@ -302,7 +306,7 @@ static int FrameSpanAddDescription( demux_t *p_demux, uint64_t i_desc_offset, fr
} }
else else
{ {
if( i_desc_size >= i_peek_len ) if( i_desc_size >= (unsigned)i_peek_len )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
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