oox/source/drawingml/textfield.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit e5b86ec34da98d92a749885a06e9093c0f64af80
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Jan 16 09:29:14 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Jan 16 10:30:59 2023 +0000

    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 <sberg...@redhat.com>
    Tested-by: Jenkins

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 )
     {

Reply via email to