Fix overflow caused by signed long division by unsigned long.
authorYukiKita <kita.yuki@gmail.com>
Fri, 29 Jul 2016 00:25:17 +0000 (09:25 +0900)
committerYukiKita <kita.yuki@gmail.com>
Fri, 29 Jul 2016 00:25:17 +0000 (09:25 +0900)
The over flow seems to occurr when the value of 'log_avg_msec' option is relatively large.

gettime.c

index b896b5bd9923e7b818e9e88fe99eb0a369dd9f63..964a52fa237afe50a05cd7d9081c3e29c26c70fc 100644 (file)
--- a/gettime.c
+++ b/gettime.c
@@ -424,8 +424,8 @@ uint64_t mtime_since(const struct timeval *s, const struct timeval *e)
        if (sec < 0 || (sec == 0 && usec < 0))
                return 0;
 
-       sec *= 1000UL;
-       usec /= 1000UL;
+       sec *= 1000;
+       usec /= 1000;
        ret = sec + usec;
 
        return ret;