fixed bug #1535005 - System.dll corrupts the stack with 0 arguments functions
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4722 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
3131a7d728
commit
729b7cd451
1 changed files with 19 additions and 2 deletions
|
@ -305,6 +305,7 @@ SystemProc *PrepareProc(BOOL NeedForCall)
|
||||||
ChangesDone = 0,
|
ChangesDone = 0,
|
||||||
ParamIndex = 0,
|
ParamIndex = 0,
|
||||||
temp = 0, temp2, temp3, temp4;
|
temp = 0, temp2, temp3, temp4;
|
||||||
|
BOOL param_defined = FALSE;
|
||||||
SystemProc *proc = NULL;
|
SystemProc *proc = NULL;
|
||||||
char *ibuf, *ib, *sbuf, *cbuf, *cb;
|
char *ibuf, *ib, *sbuf, *cbuf, *cb;
|
||||||
|
|
||||||
|
@ -327,7 +328,8 @@ SystemProc *PrepareProc(BOOL NeedForCall)
|
||||||
SectionType = PST_PARAMS;
|
SectionType = PST_PARAMS;
|
||||||
// fake-real parameter: for COM interfaces first param is Interface Pointer
|
// fake-real parameter: for COM interfaces first param is Interface Pointer
|
||||||
ParamIndex = ((ProcType == PT_VTABLEPROC)?(2):(1));
|
ParamIndex = ((ProcType == PT_VTABLEPROC)?(2):(1));
|
||||||
temp3 = temp = 0;
|
temp3 = temp = 0;
|
||||||
|
param_defined = FALSE;
|
||||||
break;
|
break;
|
||||||
case ')': SectionType = PST_RETURN; temp3 = temp = 0; break;
|
case ')': SectionType = PST_RETURN; temp3 = temp = 0; break;
|
||||||
case '?': SectionType = PST_OPTIONS; temp = 1; break;
|
case '?': SectionType = PST_OPTIONS; temp = 1; break;
|
||||||
|
@ -397,7 +399,11 @@ SystemProc *PrepareProc(BOOL NeedForCall)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PST_PARAMS:
|
case PST_PARAMS:
|
||||||
proc->ParamCount = ParamIndex;
|
if (param_defined)
|
||||||
|
proc->ParamCount = ParamIndex;
|
||||||
|
else
|
||||||
|
// not simply zero because of vtable calls
|
||||||
|
proc->ParamCount = ParamIndex - 1;
|
||||||
case PST_RETURN:
|
case PST_RETURN:
|
||||||
case PST_OPTIONS:
|
case PST_OPTIONS:
|
||||||
break;
|
break;
|
||||||
|
@ -457,10 +463,19 @@ SystemProc *PrepareProc(BOOL NeedForCall)
|
||||||
case '_': // No param cutting specifier
|
case '_': // No param cutting specifier
|
||||||
if (proc->ParamCount > ParamIndex) ParamIndex = proc->ParamCount;
|
if (proc->ParamCount > ParamIndex) ParamIndex = proc->ParamCount;
|
||||||
temp3 = temp = 0; // Clear parameter options
|
temp3 = temp = 0; // Clear parameter options
|
||||||
|
if (proc->ParamCount != ((ProcType == PT_VTABLEPROC) ? 1 : 0))
|
||||||
|
{
|
||||||
|
// only define params if the last count wasn't zero
|
||||||
|
// this prevents errornous param count for:
|
||||||
|
// 'user32::CloseClipboard()(_)'
|
||||||
|
// for vtable calls, param count should not be one
|
||||||
|
param_defined = TRUE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ',': // Next param
|
case ',': // Next param
|
||||||
temp3 = temp = 0; // Clear parameter options
|
temp3 = temp = 0; // Clear parameter options
|
||||||
ParamIndex++;
|
ParamIndex++;
|
||||||
|
param_defined = TRUE;
|
||||||
break;
|
break;
|
||||||
case '&':
|
case '&':
|
||||||
temp = 1; break; // Special parameter option
|
temp = 1; break; // Special parameter option
|
||||||
|
@ -538,6 +553,7 @@ SystemProc *PrepareProc(BOOL NeedForCall)
|
||||||
// Param type changed?
|
// Param type changed?
|
||||||
if (temp2 != -1)
|
if (temp2 != -1)
|
||||||
{
|
{
|
||||||
|
param_defined = TRUE;
|
||||||
proc->Params[ParamIndex].Type = temp2;
|
proc->Params[ParamIndex].Type = temp2;
|
||||||
proc->Params[ParamIndex].Size = // If pointer, then 1, else by type
|
proc->Params[ParamIndex].Size = // If pointer, then 1, else by type
|
||||||
(temp == -1)?(1):((ParamSizeByType[temp2]>0)?(ParamSizeByType[temp2]):(1));
|
(temp == -1)?(1):((ParamSizeByType[temp2]>0)?(ParamSizeByType[temp2]):(1));
|
||||||
|
@ -552,6 +568,7 @@ SystemProc *PrepareProc(BOOL NeedForCall)
|
||||||
// Param source/dest changed?
|
// Param source/dest changed?
|
||||||
if (temp4 != 0)
|
if (temp4 != 0)
|
||||||
{
|
{
|
||||||
|
param_defined = TRUE;
|
||||||
if (temp3 == 0)
|
if (temp3 == 0)
|
||||||
{
|
{
|
||||||
// it may contain previous inline input
|
// it may contain previous inline input
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue