summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/window.cc')
-rw-r--r--winsup/cygwin/window.cc7
1 files changed, 7 insertions, 0 deletions
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 <sys/time.h>
#include <stdlib.h>
#include <errno.h>
+#include <limits.h>
#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);