summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-05-29 10:42:40 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-05-29 14:08:21 +0200
commitbdc74dc279946abfdcca409edc96e985699eb368 (patch)
tree331aab94c82bd832bd385d4f31521a96e38f52f5
parent0e296d25e736038e76eab1f64aacff6d1aa3e7b1 (diff)
Avoid -fsanitize=nullability in external/zlib
...as seen during CppunitTest_sw_layoutwriter: > testUserFieldTypeLanguage::TestBody finished in: 1271ms [...] > workdir/UnpackedTarball/zlib/trees.c:873:42: 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 > #0 in _tr_stored_block at workdir/UnpackedTarball/zlib/trees.c:873:5 > #1 in deflate at workdir/UnpackedTarball/zlib/deflate.c:1025:17 > #2 in ZipUtils::ThreadedDeflater::Task::doWork() at package/source/zipapi/ThreadedDeflater.cxx:163:15 [...] Change-Id: I7d4b68ab2c4fb3080fc48211236cb33ca4bf7126 Reviewed-on: https://gerrit.libreoffice.org/73143 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--external/zlib/UnpackedTarball_zlib.mk6
-rw-r--r--external/zlib/ubsan.patch11
2 files changed, 17 insertions, 0 deletions
diff --git a/external/zlib/UnpackedTarball_zlib.mk b/external/zlib/UnpackedTarball_zlib.mk
index fa476b918b7c..e74039d25089 100644
--- a/external/zlib/UnpackedTarball_zlib.mk
+++ b/external/zlib/UnpackedTarball_zlib.mk
@@ -16,4 +16,10 @@ $(eval $(call gb_UnpackedTarball_set_post_action,zlib,\
cp $(addsuffix .c,adler32 compress crc32 deflate inffast inflate inftrees trees zutil) x64 \
))
+$(eval $(call gb_UnpackedTarball_set_patchlevel,zlib,0))
+
+$(eval $(call gb_UnpackedTarball_add_patches,zlib, \
+ external/zlib/ubsan.patch \
+))
+
# vim: set noet sw=4 ts=4:
diff --git a/external/zlib/ubsan.patch b/external/zlib/ubsan.patch
new file mode 100644
index 000000000000..2d7ff8d67967
--- /dev/null
+++ b/external/zlib/ubsan.patch
@@ -0,0 +1,11 @@
+--- trees.c
++++ trees.c
+@@ -870,7 +870,7 @@
+ bi_windup(s); /* align on byte boundary */
+ put_short(s, (ush)stored_len);
+ put_short(s, (ush)~stored_len);
+- zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len);
++ if (stored_len != 0) zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len);
+ s->pending += stored_len;
+ #ifdef ZLIB_DEBUG
+ s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;