https://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=e9f8e6a439fd607adbdd846ab93267dc367b5c79 From e9f8e6a439fd607adbdd846ab93267dc367b5c79 Mon Sep 17 00:00:00 2001 From: Paul Eggert 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 . * 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