diff options
author | Eike Rathke <erack@redhat.com> | 2013-03-22 17:42:20 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-03-22 17:47:17 +0100 |
commit | e8638ad5a7196ea79d90415b86a99a4c9f110a5e (patch) | |
tree | 52ca4b73036317fd21daacfda6bfcbf25e6b7121 /basic | |
parent | a8a3beda84b848c8b24d7b1d6a9e7fa842e090ac (diff) |
in Val() check status after stringToDouble()
instead of calling checkArithmeticOverflow()
Change-Id: I2e3307ee054db77bab0a106d886823dba9e56ea8
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/runtime/methods.cxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 0318b821b780..76c8dd901207 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -1782,9 +1782,20 @@ RTLFUNC(Val) } else { - // #57844 use localized function - nResult = ::rtl::math::stringToDouble( aStr, '.', ',', NULL, NULL ); - checkArithmeticOverflow( nResult ); + rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok; + sal_Int32 nParseEnd = 0; + nResult = ::rtl::math::stringToDouble( aStr, '.', ',', &eStatus, &nParseEnd ); + if ( eStatus != rtl_math_ConversionStatus_Ok ) + StarBASIC::Error( SbERR_MATH_OVERFLOW ); + /* TODO: we should check whether all characters were parsed here, + * but earlier code silently ignored trailing nonsense such as "1x" + * resulting in 1 with the side effect that any alpha-only-string + * like "x" resulted in 0. Not changing that now (2013-03-22) as + * user macros may rely on it. */ +#if 0 + else if ( nParseEnd != aStr.getLength() ) + StarBASIC::Error( SbERR_CONVERSION ); +#endif } rPar.Get(0)->PutDouble( nResult ); |