diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-08-30 09:32:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-09-01 15:54:50 +0200 |
commit | 881f924e6bfc2ba6f22ea3d1199848095a1a2110 (patch) | |
tree | 544496b1f2443e1c8bd5cfb453bd5cdaa84201a2 /reportdesign/source | |
parent | f6f581dad7817f19a575063dc6e60e57b0f47ccd (diff) |
cid#1607430 Overflowed integer argument
and
cid#1606956 Overflowed integer argument
Change-Id: Ie940530f1538a36ab995407bc0fe01386cd10367
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172715
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'reportdesign/source')
-rw-r--r-- | reportdesign/source/filter/xml/xmlControlProperty.cxx | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/reportdesign/source/filter/xml/xmlControlProperty.cxx b/reportdesign/source/filter/xml/xmlControlProperty.cxx index 95415257a40d..e2b5203c079b 100644 --- a/reportdesign/source/filter/xml/xmlControlProperty.cxx +++ b/reportdesign/source/filter/xml/xmlControlProperty.cxx @@ -194,21 +194,30 @@ Any OXMLControlProperty::convertString(const css::uno::Type& _rExpectedType, con } break; case TypeClass_SHORT: // sal_Int16 + { // it's a real int16 property + sal_Int32 nValue(0); + bool bSuccess = + ::sax::Converter::convertNumber(nValue, _rReadCharacters, + SAL_MIN_INT16, SAL_MAX_INT16); + OSL_ENSURE(bSuccess, + OStringBuffer("OXMLControlProperty::convertString: could not convert \"" + + OUStringToOString(_rReadCharacters, RTL_TEXTENCODING_ASCII_US) + + "\" into a sal_Int16!").getStr()); + aReturn <<= static_cast<sal_Int16>(nValue); + break; + } case TypeClass_LONG: // sal_Int32 - { // it's a real int32/16 property - sal_Int32 nValue(0); - bool bSuccess = - ::sax::Converter::convertNumber(nValue, _rReadCharacters); - OSL_ENSURE(bSuccess, - OStringBuffer("OXMLControlProperty::convertString: could not convert \"" + - OUStringToOString(_rReadCharacters, RTL_TEXTENCODING_ASCII_US) + - "\" into an integer!").getStr()); - if (TypeClass_SHORT == _rExpectedType.getTypeClass()) - aReturn <<= static_cast<sal_Int16>(nValue); - else - aReturn <<= nValue; - break; - } + { // it's a real int32 property + sal_Int32 nValue(0); + bool bSuccess = + ::sax::Converter::convertNumber(nValue, _rReadCharacters); + OSL_ENSURE(bSuccess, + OStringBuffer("OXMLControlProperty::convertString: could not convert \"" + + OUStringToOString(_rReadCharacters, RTL_TEXTENCODING_ASCII_US) + + "\" into a sal_Int32!").getStr()); + aReturn <<= nValue; + break; + } case TypeClass_HYPER: { OSL_FAIL("OXMLControlProperty::convertString: 64-bit integers not implemented yet!"); |