From e5b86ec34da98d92a749885a06e9093c0f64af80 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Mon, 16 Jan 2023 09:29:14 +0300 Subject: Use o3tl::toInt32 in oox/source/drawingml/textfield.cxx rtl_ustr_toInt32 was incorrectly used, relying on null-terminated content of string views. Change-Id: Ia3e4bb04a029149e5945274f592252704c34f3eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145549 Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- oox/source/drawingml/textfield.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'oox/source/drawingml/textfield.cxx') diff --git a/oox/source/drawingml/textfield.cxx b/oox/source/drawingml/textfield.cxx index 2640aa52ce12..ce38159c5e99 100644 --- a/oox/source/drawingml/textfield.cxx +++ b/oox/source/drawingml/textfield.cxx @@ -121,7 +121,7 @@ void lclCreateTextFields( std::vector< Reference< XTextField > > & aFields, } else if ( o3tl::starts_with(sType, u"file") ) { - int idx = rtl_ustr_toInt32(sType.data() + 4, 10); + int idx = o3tl::toInt32(sType.substr(4)); xIface = xFactory->createInstance( "com.sun.star.text.TextField.FileName" ); aFields.emplace_back( xIface, UNO_QUERY ); Reference< XPropertySet > xProps( xIface, UNO_QUERY_THROW ); @@ -215,7 +215,7 @@ SvxDateFormat TextField::getLODateFormat(std::u16string_view rDateTimeType) if( aDateTimeNum.empty() ) // "datetime" return SvxDateFormat::StdSmall; - int nDateTimeNum = rtl_ustr_toInt32(aDateTimeNum.data(), 10); + int nDateTimeNum = o3tl::toInt32(aDateTimeNum); switch( nDateTimeNum ) { @@ -244,7 +244,7 @@ SvxDateFormat TextField::getLODateFormat(std::u16string_view rDateTimeType) SvxTimeFormat TextField::getLOTimeFormat(std::u16string_view rDateTimeType) { auto aDateTimeNum = rDateTimeType.substr(8); - int nDateTimeNum = rtl_ustr_toInt32(aDateTimeNum.data(), 10); + int nDateTimeNum = o3tl::toInt32(aDateTimeNum); switch( nDateTimeNum ) { -- cgit