Skip to content

Commit

Permalink
Fix other places with unsigned long overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vshymanskyy authored and cjihrig committed Mar 20, 2021
1 parent 754dfdd commit adda155
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/clocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
); \
} \
\
(time) = (((sys_system.wHour * 3600) + (sys_system.wMinute * 60) + \
sys_system.wSecond) * NANOS_PER_SEC) + \
(sys_system.wMilliseconds * 1000000) + \
(((sys_user.wHour * 3600) + (sys_user.wMinute * 60) + \
sys_user.wSecond) * NANOS_PER_SEC) + \
(sys_user.wMilliseconds * 1000000); \
(time) = (((uvwasi_timestamp_t)(sys_system.wHour * 3600) + \
(sys_system.wMinute * 60) + sys_system.wSecond) * NANOS_PER_SEC) + \
((uvwasi_timestamp_t)(sys_system.wMilliseconds) * 1000000) + \
(((uvwasi_timestamp_t)(sys_user.wHour * 3600) + \
(sys_user.wMinute * 60) + sys_user.wSecond) * NANOS_PER_SEC) + \
((uvwasi_timestamp_t)(sys_user.wMilliseconds) * 1000000); \
return UVWASI_ESUCCESS; \
} while (0)

Expand All @@ -62,9 +62,9 @@
struct rusage ru; \
if (0 != getrusage((who), &ru)) \
return uvwasi__translate_uv_error(uv_translate_sys_error(errno)); \
(time) = (ru.ru_utime.tv_sec * NANOS_PER_SEC) + \
(time) = ((uvwasi_timestamp_t)(ru.ru_utime.tv_sec) * NANOS_PER_SEC) + \
(ru.ru_utime.tv_usec * 1000) + \
(ru.ru_stime.tv_sec * NANOS_PER_SEC) + \
((uvwasi_timestamp_t)(ru.ru_stime.tv_sec) * NANOS_PER_SEC) + \
(ru.ru_stime.tv_usec * 1000); \
return UVWASI_ESUCCESS; \
} while (0)
Expand All @@ -83,9 +83,9 @@
&count)) { \
return UVWASI_ENOSYS; \
} \
(time) = (info.user_time.seconds * NANOS_PER_SEC) + \
(time) = ((uvwasi_timestamp_t)(info.user_time.seconds) * NANOS_PER_SEC) + \
(info.user_time.microseconds * 1000) + \
(info.system_time.seconds * NANOS_PER_SEC) + \
((uvwasi_timestamp_t)(info.system_time.seconds) * NANOS_PER_SEC) + \
(info.system_time.microseconds * 1000); \
return UVWASI_ESUCCESS; \
} while (0)
Expand All @@ -109,7 +109,7 @@
if (0 != clock_getres((clk), &ts)) \
(time) = 1000000; \
else \
(time) = (ts.tv_sec * NANOS_PER_SEC) + ts.tv_nsec; \
(time) = ((uvwasi_timestamp_t)(ts.tv_sec) * NANOS_PER_SEC) + ts.tv_nsec; \
return UVWASI_ESUCCESS; \
} while (0)

Expand Down

0 comments on commit adda155

Please sign in to comment.