!59 [sync] PR-58: Avoid reading from invalid memory upon failure to open an input file

From: @openeuler-sync-bot 
Reviewed-by: @gaoruoshu 
Signed-off-by: @gaoruoshu
This commit is contained in:
openeuler-ci-bot 2024-04-09 09:03:47 +00:00 committed by Gitee
commit 8a73962d7e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 37 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,13 @@
%{!?with_x:%global with_x 1}
Name: groff
Version: 1.22.4
Release: 11
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
Patch3000: groff-1.22.4-sw.patch
Patch6000: backport-Avoid-reading-from-invalid-memory.patch
BuildRequires: gcc, gcc-c++ texinfo
BuildRequires: git, netpbm-progs, perl-generators, psutils, ghostscript
@ -323,6 +324,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 Apr 11 2023 yangchenguang <yangchenguang@kylinsec.com.cn> - 1.22.4-11
- fix groff build failed