summaryrefslogtreecommitdiff
path: root/app-arch/pigz/files/pigz-2.7-memcpy-ub.patch
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-01-08 00:14:55 +0000
committerV3n3RiX <venerix@koprulu.sector>2023-01-08 00:14:55 +0000
commite3a48e635527f3e2d2254e9631f7a5758df9c3fb (patch)
tree7efda32bb4a58c3099db3e763ccaf7cc08e75a50 /app-arch/pigz/files/pigz-2.7-memcpy-ub.patch
parent7a027cd18c60d9abad83a60c98ccf27db26be067 (diff)
gentoo auto-resync : 08:01:2023 - 00:14:55
Diffstat (limited to 'app-arch/pigz/files/pigz-2.7-memcpy-ub.patch')
-rw-r--r--app-arch/pigz/files/pigz-2.7-memcpy-ub.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/app-arch/pigz/files/pigz-2.7-memcpy-ub.patch b/app-arch/pigz/files/pigz-2.7-memcpy-ub.patch
new file mode 100644
index 000000000000..db53660748b4
--- /dev/null
+++ b/app-arch/pigz/files/pigz-2.7-memcpy-ub.patch
@@ -0,0 +1,26 @@
+https://github.com/madler/pigz/commit/e1ed230a1599a3cb64c8f5c003cced60e10e3314
+https://github.com/madler/pigz/issues/107
+
+From e1ed230a1599a3cb64c8f5c003cced60e10e3314 Mon Sep 17 00:00:00 2001
+From: Mark Adler <madler@alumni.caltech.edu>
+Date: Sat, 31 Dec 2022 21:28:26 -0800
+Subject: [PATCH] Avoid calling memcpy() with a NULL pointer.
+
+This is not permitted by the C99 standard even when the length is
+zero. Go figure.
+--- a/pigz.c
++++ b/pigz.c
+@@ -3414,8 +3414,10 @@ local int outb(void *desc, unsigned char *buf, unsigned len) {
+
+ // copy the output and alert the worker bees
+ out_len = len;
+- g.out_tot += len;
+- memcpy(out_copy, buf, len);
++ if (len) {
++ g.out_tot += len;
++ memcpy(out_copy, buf, len);
++ }
+ twist(outb_write_more, TO, 1);
+ twist(outb_check_more, TO, 1);
+
+