sc/source/filter/oox/revisionfragment.cxx | 14 +++++++++----- xmloff/source/chart/SchXMLCalculationSettingsContext.cxx | 6 ++++-- xmloff/source/core/DocumentSettingsContext.cxx | 6 ++++-- 3 files changed, 17 insertions(+), 9 deletions(-)
New commits: commit 9c4cfb6a95e851f5651e024e798699d71e16d968 Author: Eike Rathke <er...@redhat.com> AuthorDate: Thu Jun 30 23:49:03 2022 +0200 Commit: Eike Rathke <er...@redhat.com> CommitDate: Fri Jul 1 02:02:04 2022 +0200 Check sax::Converter::parseDateTime() success return value Change-Id: Ia843a1437a8c97e2dafc3f22d43a3dc61873269b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136686 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins (cherry picked from commit bc5380b751d2c062575afb19db28545b7512be17) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136702 diff --git a/sc/source/filter/oox/revisionfragment.cxx b/sc/source/filter/oox/revisionfragment.cxx index f6fee91c4051..350adbea90e3 100644 --- a/sc/source/filter/oox/revisionfragment.cxx +++ b/sc/source/filter/oox/revisionfragment.cxx @@ -286,11 +286,15 @@ void RevisionHeadersFragment::importHeader( const AttributeList& rAttribs ) if (!aDateTimeStr.isEmpty()) { util::DateTime aDateTime; - sax::Converter::parseDateTime(aDateTime, aDateTimeStr); - Date aDate(aDateTime); - tools::Time aTime(aDateTime); - aMetadata.maDateTime.SetDate(aDate.GetDate()); - aMetadata.maDateTime.SetTime(aTime.GetTime()); + if (sax::Converter::parseDateTime(aDateTime, aDateTimeStr)) + { + Date aDate(aDateTime); + tools::Time aTime(aDateTime); + aMetadata.maDateTime.SetDate(aDate.GetDate()); + aMetadata.maDateTime.SetTime(aTime.GetTime()); + } + else + SAL_WARN("sc.filter", "RevisionHeadersFragment: broken DateTime '" << aDateTimeStr << "'"); } aMetadata.maUserName = rAttribs.getString(XML_userName, OUString()); diff --git a/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx b/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx index 9365a791c901..fbe54c96d0f8 100644 --- a/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx +++ b/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx @@ -44,8 +44,10 @@ SchXMLCalculationSettingsContext::SchXMLCalculationSettingsContext( SvXMLImport& if ( aIter.getToken() == XML_ELEMENT(TABLE, XML_DATE_VALUE) ) { util::DateTime aNullDate; - ::sax::Converter::parseDateTime(aNullDate, aIter.toView()); - m_aNullDate <<= aNullDate; + if (::sax::Converter::parseDateTime(aNullDate, aIter.toView())) + m_aNullDate <<= aNullDate; + else + SAL_WARN("xmloff", "SchXMLCalculationSettingsContext: broken DateTime '" << aIter.toView() << "'"); } else XMLOFF_WARN_UNKNOWN("xmloff", aIter); diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx index b21010b07c81..9052a8dbaa81 100644 --- a/xmloff/source/core/DocumentSettingsContext.cxx +++ b/xmloff/source/core/DocumentSettingsContext.cxx @@ -462,8 +462,10 @@ void XMLConfigItemContext::endFastElement(sal_Int32 ) else if (IsXMLToken(msType, XML_DATETIME)) { util::DateTime aDateTime; - ::sax::Converter::parseDateTime(aDateTime, sValue); - mrAny <<= aDateTime; + if (::sax::Converter::parseDateTime(aDateTime, sValue)) + mrAny <<= aDateTime; + else + SAL_WARN("xmloff.core", "XMLConfigItemContext: broken DateTime '" << sValue << "'"); } else if (IsXMLToken(msType, XML_BASE64BINARY)) {