DCOM: Fix Infinite Loops
Robert Shearman
rob at codeweavers.com
Wed Jul 28 13:25:47 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 --------------
Index: wine/dlls/ole32/marshal.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/marshal.c,v
retrieving revision 1.23
diff -u -r1.23 marshal.c
--- wine/dlls/ole32/marshal.c 23 Jul 2004 19:10:13 -0000 1.23
+++ wine/dlls/ole32/marshal.c 28 Jul 2004 13:43:47 -0000
@@ -366,7 +389,7 @@
hres = _xwrite(req->hPipe,req->Buffer,req->reqh.cbBuffer);
if (hres) return hres;
- while (1) {
+ while (!hres) {
/*WaitForSingleObject(hRpcChanged,INFINITE);*/
hres = _read_one(xpipe);
if (hres) break;
@@ -374,12 +397,15 @@
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;
}
@@ -682,10 +735,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 == S_OK) {
int i;
hres = _read_one(xpipe);
if (hres) break;
@@ -693,11 +746,12 @@
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 (FAILED(hres)) break;
}
}
}
- FIXME("Failed with hres %lx\n",hres);
+ ERR("Failed with hres %lx\n",hres);
CloseHandle(xhPipe);
return 0;
}
More information about the wine-patches
mailing list