From 3f3bb7fef336bbe8da051644c7333bc8f4e03f11 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 15 Aug 2003 05:06:16 +0000 Subject: [PATCH] [Win32] Don't exceed handle array bounds. Warn if there would be too many 2003-08-15 Tor Lillqvist * glib/gmain.c (g_poll): [Win32] Don't exceed handle array bounds. Warn if there would be too many handles to wait for. (WaitForMultipleObjects() has a relatively low limit of 64 handles. The Win32 IO channel code should be fixed not to need to wait for one handle per file or socket being watched. Later.) --- ChangeLog | 8 ++++++++ ChangeLog.pre-2-10 | 8 ++++++++ ChangeLog.pre-2-12 | 8 ++++++++ ChangeLog.pre-2-4 | 8 ++++++++ ChangeLog.pre-2-6 | 8 ++++++++ ChangeLog.pre-2-8 | 8 ++++++++ glib/gmain.c | 5 +++++ 7 files changed, 53 insertions(+) diff --git a/ChangeLog b/ChangeLog index 83984b6..6b3a18e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-08-15 Tor Lillqvist + + * glib/gmain.c (g_poll): [Win32] Don't exceed handle array + bounds. Warn if there would be too many handles to wait + for. (WaitForMultipleObjects() has a relatively low limit of 64 + handles. The Win32 IO channel code should be fixed not to need to + wait for one handle per file or socket being watched. Later.) + 2003-08-13 Tor Lillqvist * glib/Makefile.am diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 83984b6..6b3a18e 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2003-08-15 Tor Lillqvist + + * glib/gmain.c (g_poll): [Win32] Don't exceed handle array + bounds. Warn if there would be too many handles to wait + for. (WaitForMultipleObjects() has a relatively low limit of 64 + handles. The Win32 IO channel code should be fixed not to need to + wait for one handle per file or socket being watched. Later.) + 2003-08-13 Tor Lillqvist * glib/Makefile.am diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 83984b6..6b3a18e 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,11 @@ +2003-08-15 Tor Lillqvist + + * glib/gmain.c (g_poll): [Win32] Don't exceed handle array + bounds. Warn if there would be too many handles to wait + for. (WaitForMultipleObjects() has a relatively low limit of 64 + handles. The Win32 IO channel code should be fixed not to need to + wait for one handle per file or socket being watched. Later.) + 2003-08-13 Tor Lillqvist * glib/Makefile.am diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 83984b6..6b3a18e 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +2003-08-15 Tor Lillqvist + + * glib/gmain.c (g_poll): [Win32] Don't exceed handle array + bounds. Warn if there would be too many handles to wait + for. (WaitForMultipleObjects() has a relatively low limit of 64 + handles. The Win32 IO channel code should be fixed not to need to + wait for one handle per file or socket being watched. Later.) + 2003-08-13 Tor Lillqvist * glib/Makefile.am diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 83984b6..6b3a18e 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +2003-08-15 Tor Lillqvist + + * glib/gmain.c (g_poll): [Win32] Don't exceed handle array + bounds. Warn if there would be too many handles to wait + for. (WaitForMultipleObjects() has a relatively low limit of 64 + handles. The Win32 IO channel code should be fixed not to need to + wait for one handle per file or socket being watched. Later.) + 2003-08-13 Tor Lillqvist * glib/Makefile.am diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 83984b6..6b3a18e 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +2003-08-15 Tor Lillqvist + + * glib/gmain.c (g_poll): [Win32] Don't exceed handle array + bounds. Warn if there would be too many handles to wait + for. (WaitForMultipleObjects() has a relatively low limit of 64 + handles. The Win32 IO channel code should be fixed not to need to + wait for one handle per file or socket being watched. Later.) + 2003-08-13 Tor Lillqvist * glib/Makefile.am diff --git a/glib/gmain.c b/glib/gmain.c index 699c68b..a3a9dc9 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -273,6 +273,11 @@ g_poll (GPollFD *fds, { if (f->fd == G_WIN32_MSG_HANDLE) poll_msgs = TRUE; + else if (nhandles == MAXIMUM_WAIT_OBJECTS) + { + g_warning (G_STRLOC ": Too many handles to wait for!\n"); + break; + } else { #ifdef G_MAIN_POLL_DEBUG -- 2.7.4