Browse Source

core: avoid bogus comparison on large date divider

If i_divider_num > UINT32_MAX/2 when multiplied by 2 it makes a small number
and the assert fails. We use uint64_t comparisons instead.

Fixes #29308
pull/188/head
Steve Lhomme 7 months ago
parent
commit
e8b252de75
  1. 2
      src/misc/mtime.c

2
src/misc/mtime.c

@ -99,7 +99,7 @@ vlc_tick_t date_Increment( date_t *p_date, uint32_t i_nb_samples )
if( p_date->i_remainder >= p_date->i_divider_num )
{
/* This is Bresenham algorithm. */
assert( p_date->i_remainder < 2*p_date->i_divider_num);
assert( p_date->i_remainder < UINT64_C(2)*p_date->i_divider_num);
p_date->date += 1;
p_date->i_remainder -= p_date->i_divider_num;
}

Loading…
Cancel
Save