diff --git a/0001-do-not-try-to-use-on-an-empty-string.patch b/0001-do-not-try-to-use-on-an-empty-string.patch new file mode 100644 index 0000000..1b55459 --- /dev/null +++ b/0001-do-not-try-to-use-on-an-empty-string.patch @@ -0,0 +1,25 @@ +From ff7ed27039693f91e8348495f3b909c23871123d Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Thu, 18 Jan 2018 10:42:04 +0100 +Subject: [PATCH 1/2] do not try to use [] on an empty string + +--- + src/libcmis/ws-relatedmultipart.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libcmis/ws-relatedmultipart.cxx b/src/libcmis/ws-relatedmultipart.cxx +index 3b31634..675c274 100644 +--- a/src/libcmis/ws-relatedmultipart.cxx ++++ b/src/libcmis/ws-relatedmultipart.cxx +@@ -169,7 +169,7 @@ RelatedMultipart::RelatedMultipart( const string& body, const string& contentTyp + if ( inHeaders ) + { + // Remove potential \r at the end +- if ( line[line.length() - 1] == '\r' ) ++ if ( !line.empty() && line[line.length() - 1] == '\r' ) + line = line.substr( 0, line.length() - 1 ); + + if ( line.empty( ) ) +-- +2.14.3 + diff --git a/0002-return-early-if-the-time-part-is-empty.patch b/0002-return-early-if-the-time-part-is-empty.patch new file mode 100644 index 0000000..370b061 --- /dev/null +++ b/0002-return-early-if-the-time-part-is-empty.patch @@ -0,0 +1,25 @@ +From 738528d790b2b1d52d9b72d673842969a852815d Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Thu, 18 Jan 2018 10:48:52 +0100 +Subject: [PATCH 2/2] return early if the time part is empty + +--- + src/libcmis/xml-utils.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libcmis/xml-utils.cxx b/src/libcmis/xml-utils.cxx +index d20ff47..6363af8 100644 +--- a/src/libcmis/xml-utils.cxx ++++ b/src/libcmis/xml-utils.cxx +@@ -385,5 +385,8 @@ namespace libcmis + + size_t teePos = dateTimeStr.find( 'T' ); ++ if ( teePos == string::npos || teePos == dateTimeStr.size() - 1 ) ++ return t; // obviously not a time ++ + string noTzStr = dateTimeStr.substr( 0, teePos + 1 ); + + string timeStr = dateTimeStr.substr( teePos + 1 ); +-- +2.14.3 + diff --git a/libcmis.spec b/libcmis.spec index f65a0a8..698f647 100644 --- a/libcmis.spec +++ b/libcmis.spec @@ -24,6 +24,8 @@ Patch3: 0004-Fix-test-in-test-gdrive.patch Patch4: 0005-Fix-test-in-test-onedrive.patch Patch5: 0001-update-boost.m4-to-fix-version-detection-with-gcc-6..patch Patch6: 0001-rhbz-1410197-limit-the-number-of-redirections.patch +Patch7: 0001-do-not-try-to-use-on-an-empty-string.patch +Patch8: 0002-return-early-if-the-time-part-is-empty.patch %description LibCMIS is a C/C++ client library for working with CM (content management)