Piotr Caban : server: Avoid infinite loop when we' re out of timers in set_win_timer server call.
Alexandre Julliard
julliard at winehq.org
Tue Feb 28 03:45:56 CST 2017
Module: wine
Branch: oldstable
Commit: 9009008995343c352536b5ecfd9ce8f482c0a82b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9009008995343c352536b5ecfd9ce8f482c0a82b
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon Jan 25 09:59:46 2016 +0100
server: Avoid infinite loop when we're out of timers in set_win_timer server call.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit cefdbd59b7ff189f058782021b746c33a975b5e3)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
server/queue.c | 12 ++++++++++--
server/trace.c | 1 +
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/server/queue.c b/server/queue.c
index 3099e12..720d645 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -2581,13 +2581,21 @@ DECL_HANDLER(set_win_timer)
}
else
{
+ lparam_t end_id = queue->next_timer_id;
+
/* find a free id for it */
- do
+ while (1)
{
id = queue->next_timer_id;
if (--queue->next_timer_id <= 0x100) queue->next_timer_id = 0x7fff;
+
+ if (!find_timer( queue, 0, req->msg, id )) break;
+ if (queue->next_timer_id == end_id)
+ {
+ set_win32_error( ERROR_NO_MORE_USER_HANDLES );
+ return;
+ }
}
- while (find_timer( queue, 0, req->msg, id ));
}
}
diff --git a/server/trace.c b/server/trace.c
index 4ec7aad..af8ffe6 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -5119,6 +5119,7 @@ static const struct
{ "DIRECTORY_NOT_EMPTY", STATUS_DIRECTORY_NOT_EMPTY },
{ "DISK_FULL", STATUS_DISK_FULL },
{ "DLL_NOT_FOUND", STATUS_DLL_NOT_FOUND },
+ { "ERROR_NO_MORE_USER_HANDLES", 0xc0010000 | ERROR_NO_MORE_USER_HANDLES },
{ "ERROR_CLASS_ALREADY_EXISTS", 0xc0010000 | ERROR_CLASS_ALREADY_EXISTS },
{ "ERROR_CLASS_DOES_NOT_EXIST", 0xc0010000 | ERROR_CLASS_DOES_NOT_EXIST },
{ "ERROR_CLASS_HAS_WINDOWS", 0xc0010000 | ERROR_CLASS_HAS_WINDOWS },
More information about the wine-cvs
mailing list