From 2db009368a3dfc4e33ca3606ea5a305035b3fac5 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 21 Aug 2012 01:19:42 +0200 Subject: [PATCH] windows: fix uninitialized memory access in uv_update_time() uv_update_time does not overwrite the high 32 bits of uv_loop_t.time. It merely increments it by one when the low 32 bits have wrapped. That means that `time` needs to be initialized to zero before uv_update_time() is called for the first time. --- src/win/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/win/core.c b/src/win/core.c index b55c3cea..d272bf57 100644 --- a/src/win/core.c +++ b/src/win/core.c @@ -67,6 +67,9 @@ static void uv_loop_init(uv_loop_t* loop) { loop->refs = 0; + /* To prevent uninitialized memory access, loop->time must be intialized */ + /* to zero before calling uv_update_time for the first time. */ + loop->time = 0; uv_update_time(loop); loop->pending_reqs_tail = NULL;