diff options
author | Eike Rathke <erack@redhat.com> | 2018-02-01 22:05:19 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-02-01 22:14:08 +0100 |
commit | bc697917c79609243305dcecc7aeef2f3776611c (patch) | |
tree | 885cb9abf70ab07c3904698897b5cc987ecf6515 | |
parent | e11eac6b2c7dc4ea6c8fd9fe5a7f8a20510a381d (diff) |
ofz: do not force non-existent parameters into the TokenPool
Apart from that, the hard coded storage order for ocRRI and ocIpmt
did the same as the general loop, just with a fixed number of
parameters. Instead, limit the number of arguments for the loop
for these opcodes.
Change-Id: I378ccaf60da61c1a385555451456d8422ee33c50
-rw-r--r-- | sc/source/filter/qpro/qproform.cxx | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx index 6555a7842037..70dabdedeed8 100644 --- a/sc/source/filter/qpro/qproform.cxx +++ b/sc/source/filter/qpro/qproform.cxx @@ -136,20 +136,29 @@ void QProToSc::DoFunc( DefTokenId eOc, sal_uInt16 nArgs, const sal_Char* pExtStr if( nArgs> 0 ) { - sal_Int16 nLast = nArgs- 1; - if( eOc == ocRRI ) - aPool << eParam[ 2 ] << ocSep << eParam[ 1 ] << ocSep << eParam[ 0 ]; - if( eOc == ocIpmt ) - aPool << eParam[ 3 ] << ocSep << eParam[ 2 ] << ocSep << eParam[ 1 ] << ocSep << eParam[ 0 ]; - else { - aPool << eParam[ nLast ]; - for( nCount = nLast - 1 ; nCount >= 0 ; nCount-- ) - { - if( nCount != -1 ) - aPool << ocSep << eParam[ nCount ]; - } + // There should be at least 3 arguments, but with binary crap may not.. + SAL_WARN_IF( nArgs < 3, "sc.filter","QProToSc::DoFunc - ocRRI expects 3 parameters but got " << nArgs); + // Store first 3 parameters to pool in order 2,1,0 + if (nArgs > 3) + nArgs = 3; + } + else if( eOc == ocIpmt ) + { + // There should be at least 4 arguments, but with binary crap may not.. + SAL_WARN_IF( nArgs < 4, "sc.filter","QProToSc::DoFunc - ocIpmt expects 4 parameters but got " << nArgs); + // Store first 4 parameters to pool in order 3,2,1,0 + if (nArgs > 3) + nArgs = 3; + } + + sal_Int16 nLast = nArgs - 1; + aPool << eParam[ nLast ]; + for( nCount = nLast - 1 ; nCount >= 0 ; nCount-- ) + { + if( nCount != -1 ) + aPool << ocSep << eParam[ nCount ]; } } |