PythonForWindows icon indicating copy to clipboard operation
PythonForWindows copied to clipboard

Fix rpc data marshall aligment issue

Open syjzwjj opened this issue 1 year ago • 0 comments

NdrWriteStream object use to marshall data to the memory, however, there's a problem when do alignment. Let' see the rpc interface idl below:

int Output2(
	[in] handle_t hBinding,
	[in] short* Output1,
	[in] hyper* Output2);

The code we reach the interface:

# ...
class Output2(ndr.NdrParameters):
    MEMBERS = [ndr.NdrShort, ndr.NdrHyper]

# ... 
params = Output2.pack([0x4242, 0x4141414141414141])
# ...

We observed the server side argument memory:

000001f2`8bd2d1f8  50505050`50504040 41414141`41414141
000001f2`8bd2d208  00000000`00000000 00000000`00000000
000001f2`8bd2d218  00000000`00000000 00000000`00000000

Althougth the data successful passed to the serverside with no unmarshall error, the padding data P cause confusion for me when I do rpc research, especially when it these simple type stored into structure. Hope this patch can fix this problem, thanks!

syjzwjj avatar Jul 11 '24 12:07 syjzwjj