xgettext: fix --its segfault

Resolves: rhbz#1531476
Version: 0.19.8.1-12
This commit is contained in:
Pavel Raiskup 2018-01-05 10:19:37 +01:00
parent 406636f46b
commit 94b4cda3bc
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From a0cab23332a254e3500cac2a3a984472d02180e5 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Fri, 9 Dec 2016 21:04:31 +0100
Subject: [PATCH] Fix crash of xgettext with --its option.
* gettext-tools/src/xgettext.c (main): Free contents of its_dirs only when it
was initialized. Fixes bug introduced on 2016-05-16.
---
gettext-tools/src/xgettext.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/gettext-tools/src/xgettext.c b/gettext-tools/src/xgettext.c
index f848d76d1..a80ee51ac 100644
--- a/gettext-tools/src/xgettext.c
+++ b/gettext-tools/src/xgettext.c
@@ -330,7 +330,7 @@ main (int argc, char *argv[])
bool sort_by_msgid = false;
bool sort_by_filepos = false;
char **dirs;
- char **its_dirs;
+ char **its_dirs = NULL;
char *explicit_its_filename = NULL;
const char *file_name;
const char *files_from = NULL;
@@ -1016,9 +1016,12 @@ warning: file '%s' extension '%s' is unknown; will try C"), filename, extension)
if (its_locating_rules)
locating_rule_list_free (its_locating_rules);
- for (i = 0; its_dirs[i] != NULL; i++)
- free (its_dirs[i]);
- free (its_dirs);
+ if (its_dirs != NULL)
+ {
+ for (i = 0; its_dirs[i] != NULL; i++)
+ free (its_dirs[i]);
+ free (its_dirs);
+ }
exit (EXIT_SUCCESS);
}
--
2.14.3

View File

@ -8,7 +8,7 @@
Summary: GNU libraries and utilities for producing multi-lingual messages
Name: gettext
Version: 0.19.8.1
Release: 11%{?dist}
Release: 12%{?dist}
License: GPLv3+ and LGPLv2+
Group: Development/Tools
URL: http://www.gnu.org/software/gettext/
@ -20,6 +20,9 @@ Patch0: disable-gettext-runtime-test-lock.patch
# Upstreamed patch:
# http://lists.gnu.org/archive/html/bug-gettext/2016-08/msg00006.html
Patch1: gettext-po-send-mail.patch
# Rhbz#1531476, upstream a0cab23332a254e3500cac2a3a984472d02180e5
Patch2: gettext-0.19.8-its-segfault.patch
Source2: msghack.py
Source3: msghack.1
# for bootstrapping
@ -352,6 +355,9 @@ fi
%{_mandir}/man1/msghack.1*
%changelog
* Fri Jan 05 2018 Pavel Raiskup <praiskup@redhat.com> - 0.19.8.1-12
- xgettext --its segfault fix (rhbz#1531476)
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.19.8.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild