[Libreoffice-commits] online.git: common/Util.hpp
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Thu Aug 15 06:38:46 UTC 2019
common/Util.hpp | 6 ++++++
1 file changed, 6 insertions(+)
New commits:
commit 13884468c3993abb73d09181183c50fc5484bfcc
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Aug 15 08:37:46 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Aug 15 08:38:07 2019 +0200
common: fix UB in vectorAppend()
unit-copy-paste with ubsan failed with:
common/Util.hpp:751:43: runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/string.h:43:28: note: nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior common/Util.hpp:751:43 in
Change-Id: I71ae9b43a63f979c300d704419afc9a14cd303cd
diff --git a/common/Util.hpp b/common/Util.hpp
index bbbd0716b..9e01181fa 100644
--- a/common/Util.hpp
+++ b/common/Util.hpp
@@ -744,6 +744,12 @@ int main(int argc, char**argv)
inline void vectorAppend(std::vector<char> &vector, const char *data, ssize_t length = -1)
{
size_t vlen = vector.size();
+
+ if (!data)
+ {
+ return;
+ }
+
size_t dataLen = length;
if (length < 0)
dataLen = strlen(data);
More information about the Libreoffice-commits
mailing list