rpcrt4: Avoid clearing a NULL output parameter in client_do_args().

Avoids an unhandled exception. Passing NULL as a ref pointer (which a
top-level [out] parameter necessarily is) is illegal, but this will be caught
in the CALCSIZE pass. This matches midl/widl behaviour in the -Os case.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-10-11 11:59:19 -05:00 committed by Alexandre Julliard
parent 5be461cd71
commit 43275fb178

View file

@ -422,6 +422,11 @@ static void client_free_handle(
}
}
static inline BOOL param_needs_alloc( PARAM_ATTRIBUTES attr )
{
return attr.IsOut && !attr.IsIn && !attr.IsBasetype && !attr.IsByValue;
}
void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase,
void **fpu_args, unsigned short number_of_params, unsigned char *pRetVal )
{
@ -453,11 +458,8 @@ void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum s
switch (phase)
{
case STUBLESS_INITOUT:
if (!params[i].attr.IsBasetype && params[i].attr.IsOut &&
!params[i].attr.IsIn && !params[i].attr.IsByValue)
{
if (param_needs_alloc(params[i].attr) && *(unsigned char **)pArg)
memset( *(unsigned char **)pArg, 0, calc_arg_size( pStubMsg, pTypeFormat ));
}
break;
case STUBLESS_CALCSIZE:
if (params[i].attr.IsSimpleRef && !*(unsigned char **)pArg)
@ -1138,11 +1140,6 @@ LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char * args, uns
}
#endif
static inline BOOL param_needs_alloc( PARAM_ATTRIBUTES attr )
{
return attr.IsOut && !attr.IsIn && !attr.IsBasetype && !attr.IsByValue;
}
static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg,
PFORMAT_STRING pFormat, enum stubless_phase phase,
unsigned short number_of_params)