Fix the overflow check to not depend on pStubMsg->BufferStart and
pStubMsg->BufferEnd being valid, because they aren't filled in when using MIDL-generated server stubs. Don't set the pointer to NULL on unmarshaling because we may want to unmarshal the value to an existing pointer instead of allocating a new one.
This commit is contained in:
parent
e95464a5cb
commit
552f18211d
|
@ -97,8 +97,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||||
#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
|
#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
|
||||||
|
|
||||||
#define STD_OVERFLOW_CHECK(_Msg) do { \
|
#define STD_OVERFLOW_CHECK(_Msg) do { \
|
||||||
TRACE("buffer=%d/%ld\n", _Msg->Buffer - _Msg->BufferStart, _Msg->BufferLength); \
|
TRACE("buffer=%d/%ld\n", _Msg->Buffer - (unsigned char *)_Msg->RpcMsg->Buffer, _Msg->BufferLength); \
|
||||||
if (_Msg->Buffer > _Msg->BufferEnd) ERR("buffer overflow %d bytes\n", _Msg->Buffer - _Msg->BufferEnd); \
|
if (_Msg->Buffer > (unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength) \
|
||||||
|
ERR("buffer overflow %d bytes\n", _Msg->Buffer - ((unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define NDR_TABLE_SIZE 128
|
#define NDR_TABLE_SIZE 128
|
||||||
|
@ -752,8 +753,6 @@ void WINAPI PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
||||||
RpcRaiseException(RPC_X_BAD_STUB_DATA);
|
RpcRaiseException(RPC_X_BAD_STUB_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
*pPointer = NULL;
|
|
||||||
|
|
||||||
if (pointer_id) {
|
if (pointer_id) {
|
||||||
m = NdrUnmarshaller[*desc & NDR_TABLE_MASK];
|
m = NdrUnmarshaller[*desc & NDR_TABLE_MASK];
|
||||||
if (m) m(pStubMsg, pPointer, desc, fMustAlloc);
|
if (m) m(pStubMsg, pPointer, desc, fMustAlloc);
|
||||||
|
|
Loading…
Reference in New Issue