mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-27 15:45:54 +00:00
prevent integer overflow on 32 bit
On 32 bit machine timespec->tv_sec (time_t) is 32 bit. Also 1000 * 1000 * 1000 is 32 bit. The multiplication of 2 32 bit integers gives a 32 bit integer, however this can overflow. Converting the first factor to 64 bit before the multiplication solves the issue. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
6001d8905e
commit
068bf4e83d
@ -164,7 +164,7 @@ static void rendering_incorrect(const char *msg)
|
||||
|
||||
static inline red_time_t timespec_to_red_time(struct timespec *time)
|
||||
{
|
||||
return time->tv_sec * (1000 * 1000 * 1000) + time->tv_nsec;
|
||||
return (red_time_t) time->tv_sec * (1000 * 1000 * 1000) + time->tv_nsec;
|
||||
}
|
||||
|
||||
static clockid_t clock_id;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user