Backported upstream patch, Fixed allocation typo leading to crash

This commit is contained in:
Than Ngo 2025-03-27 13:46:27 +01:00
commit d7a248ef6e
2 changed files with 32 additions and 1 deletions

View file

@ -0,0 +1,26 @@
diff --git a/NEWS b/NEWS
index 73d98d6..bfc4035 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ GNU diffutils NEWS -*- outline -*-
file to a nonempty regular file.
[bug#76452 introduced in 3.11]
+ diff -y no longer crashes when given nontrivial differences.
+ [bug#76613 introduced in 3.11]
+
* Noteworthy changes in release 3.11 (2025-02-02) [stable]
diff --git a/src/io.c b/src/io.c
index a62c529..eba4aba 100644
--- 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;

View file

@ -1,9 +1,11 @@
Summary: GNU collection of diff utilities
Name: diffutils
Version: 3.11
Release: 1%{?dist}
Release: 2%{?dist}
URL: https://www.gnu.org/software/diffutils/diffutils.html
Source: https://ftp.gnu.org/gnu/diffutils/diffutils-%{version}.tar.xz
# upstream fixes
Patch10: diffutils-3.11-allocation-typo-leading-to-crashes.patch
License: GPL-3.0-or-later
Provides: bundled(gnulib)
BuildRequires: gcc
@ -53,6 +55,9 @@ make check
%{_infodir}/diffutils.info*
%changelog
* Thu Mar 27 2025 Than Ngo <than@redhat.com> - 3.11-2
- Backported upstream patch, Fixed allocation typo leading to crash
* Thu Mar 27 2025 Than Ngo <than@redhat.com> - 3.11-1
- Fixed rhbz#2343469, Update to 3.11