Module: wine Branch: master Commit: cefdbd59b7ff189f058782021b746c33a975b5e3 URL: http://source.winehq.org/git/wine.git/?a=commit;h=cefdbd59b7ff189f058782021b...
Author: Piotr Caban piotr@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@codeweavers.com Signed-off-by: Alexandre Julliard julliard@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 7fe0d03..771a2e3 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 1b63894..2a3aba9 100644 --- a/server/trace.c +++ b/server/trace.c @@ -5136,6 +5136,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 },