summaryrefslogtreecommitdiffstats
path: root/external/zlib/ubsan.patch
blob: 2d7ff8d679678ea8d6eb1a7dc3981b5c4f0eaa27 (plain)
1
2
3
4
5
6
7
8
9
10
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;