From c56ae6454a7ac6ac6f2c10efd128d1e3ab1dc013 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 13 Aug 2019 10:32:45 +0200 Subject: Fix overly restrictive limit checks Change-Id: I7a67208e500e79f62dad1eee1b89f96e0958ccc3 Reviewed-on: https://gerrit.libreoffice.org/77380 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- cui/source/options/optaboutconfig.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cui') diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 41d590a6953f..aa5d960e7552 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -636,7 +636,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, Button*, void ) sal_Int32 nNumb = sNewValue.toInt32(); //if the value is 0 and length is not 1, there is something wrong - if( ( nNumb==0 && sNewValue.getLength()!=1 ) || nNumb >= SAL_MAX_INT16 || nNumb <= SAL_MIN_INT16) + if( ( nNumb==0 && sNewValue.getLength()!=1 ) || nNumb > SAL_MAX_INT16 || nNumb < SAL_MIN_INT16) throw uno::Exception("out of range short", nullptr); nShort = static_cast(nNumb); pProperty->Value <<= nShort; @@ -644,28 +644,28 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, Button*, void ) else if( sPropertyType == "long" ) { sal_Int32 nLong = sNewValue.toInt32(); - if( ( nLong==0 && sNewValue.getLength()!=1 ) || nLong >= SAL_MAX_INT32 || nLong <= SAL_MIN_INT32) + if( nLong==0 && sNewValue.getLength()!=1) throw uno::Exception("out of range long", nullptr); pProperty->Value <<= nLong; } else if( sPropertyType == "hyper") { sal_Int64 nHyper = sNewValue.toInt64(); - if( ( nHyper==0 && sNewValue.getLength()!=1 ) || nHyper >= SAL_MAX_INT32 || nHyper <= SAL_MIN_INT32) + if( nHyper==0 && sNewValue.getLength()!=1) throw uno::Exception("out of range hyper", nullptr); pProperty->Value <<= nHyper; } else if( sPropertyType == "double") { double nDoub = sNewValue.toDouble(); - if( ( nDoub ==0 && sNewValue.getLength()!=1 ) || nDoub >= SAL_MAX_INT32 || nDoub <= SAL_MIN_INT32) + if( nDoub ==0 && sNewValue.getLength()!=1) throw uno::Exception("out of range double", nullptr); pProperty->Value <<= nDoub; } else if( sPropertyType == "float") { float nFloat = sNewValue.toFloat(); - if( ( nFloat ==0 && sNewValue.getLength()!=1 ) || nFloat >= SAL_MAX_INT32 || nFloat <= SAL_MIN_INT32) + if( nFloat ==0 && sNewValue.getLength()!=1) throw uno::Exception("out of range float", nullptr); pProperty->Value <<= nFloat; } -- cgit