gentoo-ebuilds/sys-apps/diffutils/files/diffutils-3.11-allocation-crash.patch
Sam James 277ce2dbcc
sys-apps/diffutils: backport regression fixes to 3.11
Signed-off-by: Sam James <sam@gentoo.org>
2025-03-14 06:45:49 +00:00

29 lines
870 B
Diff

https://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=e9f8e6a439fd607adbdd846ab93267dc367b5c79
From e9f8e6a439fd607adbdd846ab93267dc367b5c79 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri, 28 Feb 2025 22:53:28 -0800
Subject: diff: fix allocation typo leading to crashes
But reported by Nick Smallbone, with one-line fix by
Collin Funk <https://bugs.gnu.org/76613>.
* src/io.c (find_and_hash_each_line): Fix size computation.
---
src/io.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
--- a/src/io.c
+++ b/src/io.c
@@ -1012,7 +1012,7 @@ find_and_hash_each_line (struct file_data *current)
linbuf += linbuf_base;
linbuf = xpalloc (linbuf, &n, 1, -1, sizeof *linbuf);
linbuf -= linbuf_base;
- alloc_lines = n - linbuf_base;
+ alloc_lines = linbuf_base + n;
}
linbuf[line] = p;
--
cgit v1.1