From 943f9c0356204683e295288e0bd8558abc98ae03 Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 9 Feb 2017 19:28:59 -0800 Subject: [PATCH] vpx_usec_timer_elapsed: use 64-bit math this prevents a rollover when tv_sec is a long: signed integer overflow: 2776 * 1000000 cannot be represented in type 'long' Change-Id: I03dc4476ee122b02e2856dad28358a20cf16a9f8 --- vpx_ports/vpx_timer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vpx_ports/vpx_timer.h b/vpx_ports/vpx_timer.h index c1f1b6027..2083b4ece 100644 --- a/vpx_ports/vpx_timer.h +++ b/vpx_ports/vpx_timer.h @@ -83,7 +83,7 @@ static INLINE int64_t vpx_usec_timer_elapsed(struct vpx_usec_timer *t) { struct timeval diff; timersub(&t->end, &t->begin, &diff); - return diff.tv_sec * 1000000 + diff.tv_usec; + return (int64_t)diff.tv_sec * 1000000 + diff.tv_usec; #endif } -- 2.40.0