[Wine-patches] [2/2] ntdll: Prevent crash (eterbug #2827).

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Ср Фев 4 14:19:20 MSK 2009


----------- следующая часть -----------
From e72f6f3355e9069e1be29e2cd1d86f22b8eec9a7 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Wed, 4 Feb 2009 13:45:52 +0300
Subject: [PATCH] ntdll: Prevent crash (eterbug #2827).

---
 dlls/ntdll/serial.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c
index 3fae4ac..ab2dcf1 100644
--- a/dlls/ntdll/serial.c
+++ b/dlls/ntdll/serial.c
@@ -72,6 +72,7 @@
 #include "wine/server.h"
 #include "wine/library.h"
 #include "wine/debug.h"
+#include "wine/exception.h"
 
 #ifdef HAVE_LINUX_SERIAL_H
 #ifdef HAVE_ASM_TYPES_H
@@ -966,6 +967,7 @@ static DWORD CALLBACK wait_for_event(LPVOID arg)
 {
     async_commio *commio = (async_commio*) arg;
     int fd, needs_close;
+    DWORD events;
 
     if (!server_get_unix_fd( commio->hDevice, FILE_READ_DATA | FILE_WRITE_DATA, &fd, &needs_close, NULL, NULL ))
     {
@@ -990,19 +992,19 @@ static DWORD CALLBACK wait_for_event(LPVOID arg)
             get_irq_info(fd, &new_irq_info);
             if (get_modem_status(fd, &new_mstat))
                 TRACE("get_modem_status failed\n");
-            *commio->events = check_events(fd, commio->evtmask,
-                                           &new_irq_info, &commio->irq_info,
-                                           new_mstat, commio->mstat);
-            if (*commio->events) break;
+            events = check_events(fd, commio->evtmask, &new_irq_info,
+                                  &commio->irq_info, new_mstat, commio->mstat);
+            if (events) break;
             get_wait_mask(commio->hDevice, &new_evtmask);
             if (commio->evtmask != new_evtmask)
             {
-                *commio->events = 0;
+                events = 0;
                 break;
             }
         }
         if (needs_close) close( fd );
     }
+    __TRY { *commio->events = events; } __EXCEPT_PAGE_FAULT {} __ENDTRY
     if (commio->hEvent) NtSetEvent(commio->hEvent, NULL);
     RtlFreeHeap(GetProcessHeap(), 0, commio);
     return 0;
-- 
1.6.0.2.GIT



Подробная информация о списке рассылки Wine-patches