diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx index 6a2a22c1be95..6555a7842037 100644 --- a/sc/source/filter/qpro/qproform.cxx +++ b/sc/source/filter/qpro/qproform.cxx @@ -94,8 +94,12 @@ void QProToSc::DoFunc( DefTokenId eOc, sal_uInt16 nArgs, const sal_Char* pExtStr if( nArgs < nBufSize ) { - for( nCount = 0; nCount < nArgs ; nCount++ ) + for( nCount = 0; nCount < nArgs && aStack.HasMoreTokens() ; nCount++ ) aStack >> eParam[ nCount ]; + + if (nCount < nArgs) + // Adapt count to reality. All sort of binary crap is possible. + nArgs = static_cast(nCount); } else return;