[Libreoffice-commits] core.git: external/zlib

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed May 29 12:09:18 UTC 2019


 external/zlib/UnpackedTarball_zlib.mk |    6 ++++++
 external/zlib/ubsan.patch             |   11 +++++++++++
 2 files changed, 17 insertions(+)

New commits:
commit bdc74dc279946abfdcca409edc96e985699eb368
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed May 29 10:42:40 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed May 29 14:08:21 2019 +0200

    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 at redhat.com>

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;


More information about the Libreoffice-commits mailing list