Fix forwards accepting arguments of the wrong type (#2593)
CForward::ProcessArguments returns whether the arguments are valid, but its error paths return !!SetError(...), which is true for any error code. Mismatched arguments were therefore accepted and the forward ran anyway, while m_errstate stayed set and made the next Execute() on that forward fail with a stale error. Claude-Session: https://claude.ai/code/session_01BxFXSTjEk7Dub57XRmVfqU Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b34de51b8c
commit
8ba0672cd9
@@ -212,11 +212,11 @@ CForward *CForward::CreateForward(const char *name, ExecType et, unsigned int nu
|
||||
|
||||
bool CForward::ProcessArguments(const CallArgs& args) {
|
||||
if (args.error)
|
||||
return !!SetError(SP_ERROR_PARAMS_MAX);
|
||||
return !SetError(SP_ERROR_PARAMS_MAX);
|
||||
|
||||
for (uint32_t i = 0; i < args.argc; i++) {
|
||||
if (i >= m_numparams)
|
||||
return !!SetError(SP_ERROR_PARAM);
|
||||
return !SetError(SP_ERROR_PARAM);
|
||||
|
||||
ParamType pt = m_types[i];
|
||||
if (pt == Param_Any)
|
||||
@@ -227,28 +227,28 @@ bool CForward::ProcessArguments(const CallArgs& args) {
|
||||
case CallArgs::ARG_CELL:
|
||||
if (arg.flags & CallArgs::FLAG_CELL_TYPE_FLOAT) {
|
||||
if (pt != Param_Float)
|
||||
return !!SetError(SP_ERROR_PARAM);
|
||||
return !SetError(SP_ERROR_PARAM);
|
||||
} else {
|
||||
if (pt != Param_Cell)
|
||||
return !!SetError(SP_ERROR_PARAM);
|
||||
return !SetError(SP_ERROR_PARAM);
|
||||
}
|
||||
break;
|
||||
case CallArgs::ARG_CELL_BY_REF:
|
||||
if (arg.flags & CallArgs::FLAG_CELL_TYPE_FLOAT) {
|
||||
if (pt != Param_FloatByRef)
|
||||
return !!SetError(SP_ERROR_PARAM);
|
||||
return !SetError(SP_ERROR_PARAM);
|
||||
} else {
|
||||
if (pt != Param_CellByRef)
|
||||
return !!SetError(SP_ERROR_PARAM);
|
||||
return !SetError(SP_ERROR_PARAM);
|
||||
}
|
||||
break;
|
||||
case CallArgs::ARG_ARRAY:
|
||||
if (pt != Param_Array)
|
||||
return !!SetError(SP_ERROR_PARAM);
|
||||
return !SetError(SP_ERROR_PARAM);
|
||||
break;
|
||||
case CallArgs::ARG_CHAR_ARRAY:
|
||||
if (pt != Param_String)
|
||||
return !!SetError(SP_ERROR_PARAM);
|
||||
return !SetError(SP_ERROR_PARAM);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user