Commit c34b980c authored by Tobias Güntner's avatar Tobias Güntner Committed by Rémi Denis-Courmont

Improve range check.

Use >= instead of > in range check because INT64_MAX could
be rounded up when converted to a double for comparison.
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent f5f890f8
......@@ -1357,8 +1357,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if( p_sys->f_npt_length > 0 )
{
double d_length = p_sys->f_npt_length * 1000000.0;
/* Not sure if -0.5 is needed, but better be safe */
if( d_length - 0.5 > INT64_MAX )
if( d_length >= INT64_MAX )
*pi64 = INT64_MAX;
else
*pi64 = (int64_t)d_length;
......
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