libreoffice/external/libcmis/libcmis-fix-error-handling.patch
Thorsten Behrens 1188061c25 libcmis: error handling for datetime string parser
Change-Id: Ie5be0307fa8ac0292f7692f9674e07776cb1948d
Reviewed-on: https://gerrit.libreoffice.org/31777
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2016-12-11 02:42:03 +00:00

21 lines
831 B
Diff

diff -ur cmis.org/src/libcmis/xml-utils.cxx cmis/src/libcmis/xml-utils.cxx
--- cmis.org/src/libcmis/xml-utils.cxx 2016-12-09 02:19:47.900961750 +0100
+++ cmis/src/libcmis/xml-utils.cxx 2016-12-09 02:23:56.392206339 +0100
@@ -382,9 +382,14 @@
// Get the time zone offset
boost::posix_time::time_duration tzOffset( boost::posix_time::duration_from_string( "+00:00" ) );
+ if ( dateTimeStr.empty( ) )
+ return t; // obviously not a time
+
size_t teePos = dateTimeStr.find( 'T' );
- string noTzStr = dateTimeStr.substr( 0, teePos + 1 );
+ if ( teePos == string::npos )
+ return t; // obviously not a time
+ string noTzStr = dateTimeStr.substr( 0, teePos + 1 );
string timeStr = dateTimeStr.substr( teePos + 1 );
// Get the TZ if any