demux/asf: prevent signed integer overflow (fixes #17579)
The previous implementation could overflow the mtime_t when
multiplying p_sys->p_fp->i_preroll by a thousand when converting from
the asf time unit (milliseconds) to VLCs (microseconds).
Given that you can always divide a value without running into issues
in terms of under/overflow, these changes prevent any overflow error
while still preserving the same logic.
In short the implementation takes advantage of the below two
conditions being equivalent:
1: A > ( ( B * C ) + D )
2: ( ( A - D ) / C ) > B
Signed-off-by:
Rémi Denis-Courmont <remi@remlab.net>
Please register or sign in to comment