Commit Graph

215 Commits

Author SHA1 Message Date
Rob Shearman 86a0b1d24e rpcrt4: Implement NdrConformantStringMemorySize. 2007-12-31 16:47:55 +01:00
Rob Shearman eeeed91d92 rpcrt4: Implement non-conformant string functions. 2007-12-31 16:46:10 +01:00
Rob Shearman 3e8a032e8b rpcrt4: Re-use existing memory for embedded pointers in NdrVaryingArrayUnmarshall. 2007-12-26 14:02:58 +01:00
Rob Shearman 273766ee6f rpcrt4: Re-use existing memory for embedded pointers in NdrConformantVaryingArrayUnmarshall. 2007-12-26 14:02:55 +01:00
Rob Shearman 698ba6b4d4 rpcrt4: Implement higher-level NDR server context handle functions.
Implement NdrServerContextMarshall and NdrServerContextNewMarshall on
top of NDRSContextMarshall2. Implement NdrContextHandleInitialize,
NdrServerContextUnmarshall and NdrServerContextNewUnmarshall on top of
NDSContextUnmarshall2.
2007-12-26 13:26:38 +01:00
Rob Shearman cf6d95c1b8 rpcrt4: Move low-level NDR context handle functions to a separate file. 2007-12-26 13:26:30 +01:00
Rob Shearman 64d1e2d8e3 rpcrt4: Set pStubMsg->BufferMark in NdrConformantVaryingArrayUnmarshall and NdrVaryingArrayUnmarshall.
pStubMsg->BufferMark should always be set before
EmbeddedPointerUnmarshall is called and these functions didn't
previously do so.
2007-12-23 13:55:27 +01:00
Rob Shearman 17eb6f44ad rpcrt4: Print an error if stub buffer pointer is passed into safe_copy_from_buffer.
Also print an error message if there was an overflow.
2007-12-21 12:41:18 +01:00
Rob Shearman 9a888e6465 rpcrt4: Fix NdrConformantStringUnmarshall to always increment the buffer during unmarshalling.
safe_copy_from_buffer has the side-effect of incrementing the buffer and 
this still needs to be done when we point the memory into the buffer.

(Thanks to Maarten Lankhorst for finding the mistake and suggesting a fix.)
2007-12-20 12:10:30 +01:00
Rob Shearman 22b20879f7 rpcrt4: Memory should only be cleared in ComplexUnmarshall, not in ComplexMarshall.
Also clear memory when FC_STRUCTPAD* is encountered.
2007-12-19 19:35:02 +01:00
Rob Shearman 50cab7736a rpcrt4: Fix the ALIGN_POINTER_CLEAR macro. 2007-12-19 19:34:56 +01:00
Rob Shearman b9c92e9564 rpcrt4: Don't copy memory from the buffer in NdrConformantStringUnmarshall if we just pointed the memory pointer into the buffer.
(Reported by Dan Kegel.)
2007-12-18 12:32:55 +01:00
Rob Shearman 259879d1f5 rpcrt4: Fix NdrConformantStringUnmarshall to use buffer memory if possible. 2007-12-17 11:58:06 +01:00
Rob Shearman b300189c43 rpcrt4: Add a FIXME for RPC_FC_P_ALLOCALLNODES in PointerUnmarshall. 2007-12-17 11:58:00 +01:00
Rob Shearman 68432dd339 rpcrt4: Clear padding inserted into the buffer during marshalling because of alignment. 2007-12-17 11:57:54 +01:00
Rob Shearman 25bf0a409a rpcrt4: Update TODO list.
Out-of-memory check is performed by NdrAllocate and so isn't required to 
be done in the unmarshalling functions.
2007-12-14 12:24:34 +01:00
Rob Shearman 4a028589eb rpcrt4: Document NdrAllocate. 2007-12-14 12:24:24 +01:00
Rob Shearman c7261b732b rpcrt4: Partially revert commit 18faf3184b2ea263d77c2a7ad92eef27bc4ba08f.
Tests show that NdrPointerFree (and hence NdrFree) don't check whether 
the memory was allocated with NdrAllocate before freeing it. This makes 
sense as servers don't need to use NdrAllocate to allocate memory being 
returned and so this commit caused that memory to be leaked.

NdrAllocate hasn't been changed as the tests show it is correct and it 
appears that the memory list is used to implement the RpcSs memory model.
2007-12-14 12:24:21 +01:00
Rob Shearman ce220e2b5f rpcrt4: Free the base pointer in PointerFree when freeing a pointer with RPC_FC_P_DEREF. 2007-12-14 12:24:03 +01:00
Rob Shearman d5ff3467bc rpcrt4: Fix the check in NdrPointerFree.
Add comments to justify why this is the only check that is needed.
2007-12-14 12:23:55 +01:00
Rob Shearman ded4b86625 Revert "rpcrt4: Try to free every non-stack pointer in PointerFree now that NdrFree does the sanity checking for us.".
This reverts commit 6db648302ce43f625a073426a35a6f40b7869d8b.

Tests show the assumptions in a commit that this commit depends on are 
not valid.
2007-12-14 12:23:38 +01:00
Rob Shearman e12b487e26 rpcrt4: Try to free every non-stack pointer in PointerFree now that NdrFree does the sanity checking for us. 2007-12-12 16:02:53 +01:00
Rob Shearman 9c8c74f388 rpcrt4: Store allocated memory in a singly-linked list to keep track of what we should and shouldn't free in NdrFree. 2007-12-12 16:02:43 +01:00
Rob Shearman 766d8a17af rpcrt4: Pass the USER_MARSHAL_CB structure into user marshal routines. 2007-12-10 12:04:28 +01:00
Rob Shearman a07afe7e06 rpcrt4: Implement NdrConformantArrayMemorySize. 2007-12-10 12:04:15 +01:00
Rob Shearman 417b9d80f2 rpcrt4: Save the buffer in EmbeddedPointerMemorySize, like EmbeddedPointerUnmarshall does. 2007-12-08 19:58:11 +01:00
Rob Shearman d7a0de303e rpcrt4: Fix the return value from NdrSimpleStructMemorySize. 2007-12-08 19:58:07 +01:00
Rob Shearman 3a13de3115 rpcrt4: Add a trace to NdrBaseTypeMemorySize. 2007-12-08 19:58:03 +01:00
Rob Shearman 7ae1d44816 rpcrt4: Implement PointerMemorySize. 2007-12-08 19:57:55 +01:00
Rob Shearman 8348f0413d rpcrt4: Fix NdrConformantStructUnmarshall to use buffer memory if applicable and to reuse memory for embedded pointers. 2007-12-08 19:57:46 +01:00
Rob Shearman a5f9ed81e3 rpcrt4: Fix NdrFixedArrayUnmarshall to use buffer memory if applicable and to reuse memory for embedded pointers. 2007-12-08 19:57:39 +01:00
Rob Shearman abbceb137a rpcrt4: Fix NdrConformantArrayUnmarshall to use buffer memory if applicable and to reuse memory for embedded pointers. 2007-12-08 19:57:32 +01:00
Rob Shearman ba6aec70ca rpcrt4: Implement NdrConformantStructFree. 2007-12-07 17:06:05 +01:00
Rob Shearman 2ebee18198 rpcrt4: Improve PointerFree to not free buffer memory. 2007-12-07 16:34:17 +01:00
Rob Shearman 13e47d762a rpcrt4: Set the memory pointer in NdrBaseTypeUnmarshall to the buffer if we're unmarshalling on a server without memory being passed in. 2007-12-05 13:49:08 +01:00
Rob Shearman 17132f7e1f rpcrt4: Set fMustAlloc to TRUE when unmarshalling an object pointer. 2007-12-05 13:48:59 +01:00
Rob Shearman 2a9fae7565 rpcrt4: Set the destination pointer in PointerUnmarshall before calling the referenced type's unmarshalling routine.
When a pointer that is dereferenced is encountered then this can result 
in a stale pointer (i.e. the one that is marshalled into the buffer for 
the embedded pointer unmarshalling case) being used instead of the one 
that was intended.
2007-12-04 18:18:01 +01:00
Rob Shearman d8e467b0fd rpcrt4: Reverse the conditions for which *pPointer is assigned base_ptr_val in PointerUnmarshall.
In one condition (fMustAlloc == TRUE), base_ptr_val may be uninitialised
and so cause a valgrind warning. Reversing the check is harmless and
doesn't result in a performance decrease.
2007-12-03 13:10:21 +01:00
Rob Shearman c735a14788 rpcrt4: Fix NdrSimpleStructUnmarshall to cope with [in, out] embedded pointers. 2007-11-30 11:56:30 +01:00
Rob Shearman b676309db3 rpcrt4: Improve PointerUnmarshall to cope with keeping the non-NULL source pointer of a client unmarshall.
This will enable various types with embedded pointers to handle [in,out] 
parameters correctly by keeping the existing memory.
2007-11-30 11:56:21 +01:00
Rob Shearman 4e8f69ac2d rpcrt4: Move forcing of fMustAlloc to NULL to the callers of EmbeddedPointerUnmarshall.
This will enable them to be individually fixed up to use memory if it 
was provided by the caller.
2007-11-30 11:56:11 +01:00
Rob Shearman 43e0c67fe2 rpcrt4: EmbeddedPointerUnmarshall doesn't need to change the address of the allocated memory, so reduce the level of indirection of the memory parameter by one. 2007-11-30 11:56:04 +01:00
Rob Shearman 8668369b4f rpcrt4: Fix an integer overflow in NdrConformantStructMarshall and NdrConformantStructUnmarshall. 2007-11-29 13:31:05 +01:00
Rob Shearman 074898ba2b rpcrt4: Fix some more potential buffer overflows. 2007-11-29 13:30:58 +01:00
Rob Shearman 5a3c34eb89 rpcrt4: Check there is enough space in the buffer and that the size doesn't cause an overflow when copying data to it. 2007-11-29 13:30:21 +01:00
Rob Shearman d0223ecc0e rpcrt4: Check for integer overflows when increasing the buffer length.
Rename safe_buffer_copy to safe_copy_from_buffer.
2007-11-29 13:30:04 +01:00
Rob Shearman 046f24a0e7 rpcrt4: Raise an exception if a NULL ref-pointer is passed in to PointerMarshall or PointerBufferSize. 2007-11-21 12:03:35 +01:00
Rob Shearman 04dc115b54 rpcrt4: Handle FC_IGNORE in the base type functions. 2007-11-05 15:06:06 +01:00
Dan Hipschman 8caa325eb7 rpcrt4: Initialize allocated pointers to NULL in PointerUnmarshall.
This patch initializes allocated pointers in PointerUnmarshall since later
code checks the value for NULL (specifically, NdrConformantArrayUnmarshall).
2007-11-05 13:24:36 +01:00
Dan Hipschman acfde97b9e rpcrt4, widl: Make pointer layouts compatible with windows; fix conformant array tests. 2007-10-11 16:24:28 +02:00