Avoid reading from invalid memory upon failure to open an input file

This commit is contained in:
shixuantong 2024-04-08 17:09:25 +08:00
parent 81072fa728
commit 24b6737ec2
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 61f2d86d93e46309f5721b3700e1b189350282dd Mon Sep 17 00:00:00 2001
From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
Date: Fri, 3 Feb 2023 05:11:46 -0600
Subject: [tbl]: Fix Savannah #63751.
* src/preproc/tbl/main.cpp (main): Avoid reading from invalid memory
upon failure to open an input file.
Fixes <https://savannah.gnu.org/bugs/?63751>.
---
src/preproc/tbl/main.cpp | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/preproc/tbl/main.cpp b/src/preproc/tbl/main.cpp
index 467c19f..a3308ba 100644
--- a/src/preproc/tbl/main.cpp
+++ b/src/preproc/tbl/main.cpp
@@ -1658,8 +1658,10 @@ int main(int argc, char **argv)
else {
errno = 0;
FILE *fp = fopen(argv[i], "r");
- if (fp == 0)
+ if (fp == 0) {
+ current_filename = 0 /* nullptr */;
fatal("can't open '%1': %2", argv[i], strerror(errno));
+ }
else {
current_lineno = 1;
string fn(argv[i]);
--
cgit v1.1

View File

@ -2,12 +2,14 @@
%{!?with_x:%global with_x 1}
Name: groff
Version: 1.22.4
Release: 10
Release: 12
Summary: A typesetting system
License: GPLv3+ and GFDL and BSD and MIT
URL: http://www.gnu.org/software/groff/
Source: http://ftp.gnu.org/gnu/groff/groff-%{version}.tar.gz
Patch6000: backport-Avoid-reading-from-invalid-memory.patch
BuildRequires: gcc, gcc-c++ texinfo
BuildRequires: git, netpbm-progs, perl-generators, psutils, ghostscript
BuildRequires: libXaw-devel, libXmu-devel
@ -320,6 +322,9 @@ make check
%{_infodir}/groff.info*
%changelog
* Mon Apr 08 2024 shixuantong <shixuantong1@huawei.com> - 1.22.4-12
- Avoid reading from invalid memory upon failure to open an input file
* Tue Oct 25 2022 yanglongkang <yanglongkang@h-partners.com> - 1.22.4-10
- rebuild for next release