From f26e3f1574c14441fd52b9009b0a00d533a88720 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 9 May 2000 13:28:11 +0000 Subject: [PATCH] * window.cc (setitimer): Check for overflow condition in tv_sec. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/window.cc | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3274a881b..de3429bbe 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +Thu May 9 15:24:00 2000 Corinna Vinschen + + Patch suggested by + * window.cc (setitimer): Check for overflow condition + in tv_sec. + Thu May 9 0:47:00 2000 Corinna Vinschen Patch suggested by Eric Fifer diff --git a/winsup/cygwin/window.cc b/winsup/cygwin/window.cc index 161057426..6651ddc54 100644 --- a/winsup/cygwin/window.cc +++ b/winsup/cygwin/window.cc @@ -13,6 +13,7 @@ details. */ #include #include #include +#include #include "winsup.h" static NO_COPY UINT timer_active = 0; @@ -154,6 +155,12 @@ setitimer (int which, const struct itimerval *value, struct itimerval *oldvalue) set_errno (EINVAL); return -1; } + /* Check if we will wrap */ + if (itv.it_value.tv_sec >= (long) (UINT_MAX / 1000)) + { + set_errno (EINVAL); + return -1; + } if (timer_active) { KillTimer (gethwnd(), timer_active);