summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-05-06 21:52:28 +0200
committerEike Rathke <erack@redhat.com>2016-05-07 01:07:19 +0200
commitc54f6161480fc3721bf8e208cd12a7446ab608b7 (patch)
tree8363af29e46ec36c7082ddcd3c9fb919f96d8335 /sc
parentcoverity#1359229 handle PopDoubleRefOrSingleRef() as usual (diff)
downloadcore-c54f6161480fc3721bf8e208cd12a7446ab608b7.tar.gz
core-c54f6161480fc3721bf8e208cd12a7446ab608b7.zip
coverity#1359230 DEADCODE, detect missing parameter, tdf#97831 follow-up
... so SWITCH with less than 3 parameters returns the proper error code instead of #N/A. Change-Id: Ib5d696a640f7084ca46c3cf8f378ea6e659e3f11
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr8.cxx10
1 files changed, 3 insertions, 7 deletions
diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx
index 1b7bf6d5380f..36304d8849aa 100644
--- a/sc/source/core/tool/interpr8.cxx
+++ b/sc/source/core/tool/interpr8.cxx
@@ -1913,6 +1913,9 @@ void ScInterpreter::ScSwitch_MS()
{
short nParamCount = GetByte();
+ if (!MustHaveParamCountMin( nParamCount, 3))
+ return;
+
ReverseStack( nParamCount );
nGlobalError = 0; // propagate only for match or active result path
@@ -1970,13 +1973,6 @@ void ScInterpreter::ScSwitch_MS()
( !isValue && aRefStr.getDataIgnoreCase() == aStr.getDataIgnoreCase() )) )
{
// TRUE
- if ( nParamCount < 1 )
- {
- // no parameter given for THEN
- nGlobalError = nFirstMatchError;
- PushParameterExpected();
- return;
- }
bFinished = true;
}
else