src: fix integer overflow in GetNow

PR-URL: https://github.com/nodejs/node/pull/22214
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
pull/22247/head
Anatoli Papirovski 2018-08-09 07:47:54 -07:00 committed by Trivikram Kamat
parent c8aa83c6dd
commit 01a160a05d
1 changed files with 1 additions and 1 deletions

View File

@ -617,7 +617,7 @@ Local<Value> Environment::GetNow() {
CHECK_GE(now, timer_base());
now -= timer_base();
if (now <= 0xffffffff)
return Integer::New(isolate(), static_cast<uint32_t>(now));
return Integer::NewFromUnsigned(isolate(), static_cast<uint32_t>(now));
else
return Number::New(isolate(), static_cast<double>(now));
}