office-gobmx/external/zlib/ubsan.patch
Stephan Bergmann bdc74dc279 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>
2019-05-29 14:08:21 +02:00

11 lines
446 B
Diff

--- 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;