diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-09-01 12:34:08 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-09-01 16:32:18 +0200 |
commit | e640d4e47366548ab1f2d938db1d9256ebfdbe70 (patch) | |
tree | 8a90915e9de5f9742730016631bafb37418bf87e /xmloff | |
parent | b28fdc6b412c30b2d16c622483be4e6ee1359121 (diff) |
cid#1606637 Overflowed integer argument
Change-Id: I83a94ce7bd2d926ca925860cc712ec5ece87ae86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172720
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/forms/propertyimport.cxx | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/xmloff/source/forms/propertyimport.cxx b/xmloff/source/forms/propertyimport.cxx index 260560d4c5c8..d89ecc71e687 100644 --- a/xmloff/source/forms/propertyimport.cxx +++ b/xmloff/source/forms/propertyimport.cxx @@ -132,21 +132,34 @@ Any PropertyConversion::convertString( const css::uno::Type& _rExpectedType, } break; case TypeClass_SHORT: // sal_Int16 + { + if (!_pEnumMap) + { // 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("PropertyConversion::convertString: could not convert \"" + + OUStringToOString(_rReadCharacters, RTL_TEXTENCODING_ASCII_US) + + "\" into a sal_Int16!").getStr()); + aReturn <<= static_cast<sal_Int16>(nValue); + break; + } + aReturn = convertAsEnum(true, _rExpectedType, _rReadCharacters, _pEnumMap); + } + break; case TypeClass_LONG: // sal_Int32 { if (!_pEnumMap) - { // it's a real int32/16 property + { // it's a real int32 property sal_Int32 nValue(0); bool bSuccess = ::sax::Converter::convertNumber(nValue, _rReadCharacters); OSL_ENSURE(bSuccess, OStringBuffer("PropertyConversion::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; + "\" into a sal_Int32!").getStr()); + aReturn <<= nValue; break; } aReturn = convertAsEnum(true, _rExpectedType, _rReadCharacters, _pEnumMap); |