Commit 6cd1a7d9 authored by Alexandre Julliard's avatar Alexandre Julliard

Authors: Robert Shearman <rob@codeweavers.com>, Mike Hearn <mh@codeweavers.com>

Fix infinite loops by checking the return value of _invoke_onereq and bailing appropriately.
parent 4c3d6617
...@@ -392,19 +392,22 @@ RPC_QueueRequestAndWait(wine_rpc_request *req) { ...@@ -392,19 +392,22 @@ RPC_QueueRequestAndWait(wine_rpc_request *req) {
/* This loop is about allowing re-entrancy. While waiting for the /* This loop is about allowing re-entrancy. While waiting for the
* response to one RPC we may receive a request starting another. */ * response to one RPC we may receive a request starting another. */
while (1) { while (!hres) {
hres = _read_one(xpipe); hres = _read_one(xpipe);
if (hres) break; if (hres) break;
for (i=0;i<nrofreqs;i++) { for (i=0;i<nrofreqs;i++) {
xreq = reqs[i]; xreq = reqs[i];
if ((xreq->state==REQSTATE_REQ_GOT) && (xreq->hPipe==req->hPipe)) { 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) if (req->state == REQSTATE_RESP_GOT)
return S_OK; return S_OK;
} }
if (FAILED(hres))
WARN("-- 0x%08lx\n", hres);
return hres; return hres;
} }
...@@ -734,10 +737,10 @@ static DWORD WINAPI ...@@ -734,10 +737,10 @@ static DWORD WINAPI
_StubReaderThread(LPVOID param) { _StubReaderThread(LPVOID param) {
wine_pipe *xpipe = (wine_pipe*)param; wine_pipe *xpipe = (wine_pipe*)param;
HANDLE xhPipe = xpipe->hPipe; HANDLE xhPipe = xpipe->hPipe;
HRESULT hres; HRESULT hres = S_OK;
TRACE("STUB reader thread %lx\n",GetCurrentProcessId()); TRACE("STUB reader thread %lx\n",GetCurrentProcessId());
while (1) { while (!hres) {
int i; int i;
hres = _read_one(xpipe); hres = _read_one(xpipe);
if (hres) break; if (hres) break;
...@@ -745,7 +748,8 @@ _StubReaderThread(LPVOID param) { ...@@ -745,7 +748,8 @@ _StubReaderThread(LPVOID param) {
for (i=nrofreqs;i--;) { for (i=nrofreqs;i--;) {
wine_rpc_request *xreq = reqs[i]; wine_rpc_request *xreq = reqs[i];
if ((xreq->state == REQSTATE_REQ_GOT) && (xreq->hPipe == xhPipe)) { if ((xreq->state == REQSTATE_REQ_GOT) && (xreq->hPipe == xhPipe)) {
_invoke_onereq(xreq); hres = _invoke_onereq(xreq);
if (!hres) break;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment