DCOM: Make typelib marshaller NX safe, don't leak assembly stub block
Mike Hearn
mh at codeweavers.com
Sun Jun 27 12:29:03 CDT 2004
Mike Hearn <mh at codeweavers.com>
Make typelib marshaller safe for systems that don't allow
executable code on the heap, plug a leak of the assembly
stub block.
Index: tmarshal.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/tmarshal.c,v
retrieving revision 1.26
diff -u -p -r1.26 tmarshal.c
--- tmarshal.c 23 Jun 2004 00:10:29 -0000 1.26
+++ tmarshal.c 27 Jun 2004 17:22:28 -0000
@@ -340,6 +340,7 @@ TMProxyImpl_Release(LPRPCPROXYBUFFER ifa
This->ref--;
if (This->ref) return This->ref;
if (This->chanbuf) IRpcChannelBuffer_Release(This->chanbuf);
+ VirtualFree(This->asmstubs, 0, MEM_RELEASE);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
@@ -1362,11 +1363,17 @@ PSFacBuf_CreateProxy(
return hres;
}
nroffuncs = _nroffuncs(tinfo);
- proxy = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(TMProxyImpl));
+ proxy = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TMProxyImpl));
if (!proxy) return E_OUTOFMEMORY;
- proxy->asmstubs=HeapAlloc(GetProcessHeap(),0,sizeof(TMAsmProxy)*nroffuncs);
assert(sizeof(TMAsmProxy) == 12);
+
+ proxy->asmstubs = VirtualAlloc(NULL, sizeof(TMAsmProxy) * nroffuncs, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+ if (!proxy->asmstubs) {
+ ERR("Could not commit pages for proxy thunks\n");
+ HeapFree(GetProcessHeap(), 0, proxy);
+ return E_OUTOFMEMORY;
+ }
proxy->lpvtbl = HeapAlloc(GetProcessHeap(),0,sizeof(LPBYTE)*nroffuncs);
for (i=0;i<nroffuncs;i++) {
More information about the wine-patches
mailing list