DCOM: Fix Infinite Loops

Robert Shearman rob at codeweavers.com
Fri Jul 30 07:09:56 CDT 2004


Changelog:

Robert Shearman <rob at codeweavers.com>
Mike Hearn <mh at codeweavers.com>
Fix infinite loops by checking the return value of _invoke_onereq and bailing appropriately.


-------------- next part --------------
? wine/dlls/ole32/custommarshal_with_oxidchange.diff
? wine/dlls/ole32/dcom_p.c
? wine/dlls/ole32/marshal.diff
? wine/dlls/ole32/ole32.diff
? wine/dlls/ole32/ole32.spec.c
? wine/dlls/ole32/ole32_ove.diff
? wine/dlls/ole32/oleproxy.diff
? wine/dlls/ole32/ove20040707.diff
? wine/dlls/ole32/proxy.c
? wine/dlls/ole32/proxy.diff
? wine/dlls/ole32/proxy.hacked
? wine/dlls/ole32/threadingmodel.diff
? wine/dlls/ole32/unknwn_p.c
Index: wine/dlls/ole32/rpc.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/rpc.c,v
retrieving revision 1.21
diff -u -r1.21 rpc.c
--- wine/dlls/ole32/rpc.c	29 Jul 2004 23:58:12 -0000	1.21
+++ wine/dlls/ole32/rpc.c	30 Jul 2004 12:05:21 -0000
@@ -392,19 +392,22 @@
 
     /* This loop is about allowing re-entrancy. While waiting for the
      * response to one RPC we may receive a request starting another. */
-    while (1) {
+    while (!hres) {
 	hres = _read_one(xpipe);
 	if (hres) break;
 
 	for (i=0;i<nrofreqs;i++) {
 	    xreq = reqs[i];
 	    if ((xreq->state==REQSTATE_REQ_GOT) && (xreq->hPipe==req->hPipe)) {
-		_invoke_onereq(xreq);
+		hres = _invoke_onereq(xreq);
+		if (hres) break;
 	    }
 	}
 	if (req->state == REQSTATE_RESP_GOT)
 	    return S_OK;
     }
+    if (FAILED(hres))
+        WARN("-- 0x%08lx\n", hres);
     return hres;
 }
 
@@ -734,10 +737,10 @@
 _StubReaderThread(LPVOID param) {
     wine_pipe		*xpipe = (wine_pipe*)param;
     HANDLE		xhPipe = xpipe->hPipe;
-    HRESULT		hres;
+    HRESULT		hres = S_OK;
 
     TRACE("STUB reader thread %lx\n",GetCurrentProcessId());
-    while (1) {
+    while (!hres) {
 	int i;
 	hres = _read_one(xpipe);
 	if (hres) break;
@@ -745,7 +748,8 @@
 	for (i=nrofreqs;i--;) {
 	    wine_rpc_request *xreq = reqs[i];
 	    if ((xreq->state == REQSTATE_REQ_GOT) && (xreq->hPipe == xhPipe)) {
-		_invoke_onereq(xreq);
+		hres = _invoke_onereq(xreq);
+		if (!hres) break;
 	    }
 	}
     }


More information about the wine-patches mailing list