• Filip Roséen's avatar
    demux/asf: prevent signed integer overflow (fixes #17579) · 86835f9f
    Filip Roséen authored and Rémi Denis-Courmont's avatar Rémi Denis-Courmont committed
    
    
    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's avatarRémi Denis-Courmont <remi@remlab.net>
    86835f9f
asf.c 48 KB