blob: 3f80cd7e7c690145b8eeb15a2e897811ef83c38a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
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
|