Fix a crash in pcretest when printing non-ASCII characters

This commit is contained in:
Petr Písař 2017-02-23 08:52:39 +01:00
parent 028b0b28a0
commit be6a110b85
2 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,54 @@
From 686660568dde71f9a7f8791cbb8a77702b3ea820 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
Date: Wed, 22 Feb 2017 17:37:47 +0000
Subject: [PATCH] Check character < 256 for isprint() in pcretest.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1685 2f5784b3-3f2a-0410-8824-cb99058d5e15
Petr Písař: Ported to 8.40.
diff --git a/pcretest.c b/pcretest.c
index 5b73a91..797f99c 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -177,7 +177,7 @@ that differ in their output from isprint() even in the "C" locale. */
#define PRINTABLE(c) ((c) >= 32 && (c) < 127)
#endif
-#define PRINTOK(c) (locale_set? isprint(c) : PRINTABLE(c))
+#define PRINTOK(c) (locale_set? (((c) < 256) && isprint(c)) : PRINTABLE(c))
/* Posix support is disabled in 16 or 32 bit only mode. */
#if !defined SUPPORT_PCRE8 && !defined NOPOSIX
diff --git a/testdata/testinput15 b/testdata/testinput15
index 83e2677..c065105 100644
--- a/testdata/testinput15
+++ b/testdata/testinput15
@@ -363,4 +363,7 @@ correctly, but that messes up comparisons). --/
/abc/89
+//8+L
+ \xf1\xad\xae\xae
+
/-- End of testinput15 --/
diff --git a/testdata/testoutput15 b/testdata/testoutput15
index bad2807..e4e123c 100644
--- a/testdata/testoutput15
+++ b/testdata/testoutput15
@@ -1136,4 +1136,9 @@ Failed: setting UTF is disabled by the application at offset 0
/abc/89
Failed: setting UTF is disabled by the application at offset 0
+//8+L
+ \xf1\xad\xae\xae
+ 0:
+ 0+ \x{6dbae}
+
/-- End of testinput15 --/
--
2.7.4

View File

@ -2,7 +2,7 @@
#%%global rcversion RC1
Name: pcre
Version: 8.40
Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist}
Release: %{?rcversion:0.}4%{?rcversion:.%rcversion}%{?dist}
%global myversion %{version}%{?rcversion:-%rcversion}
Summary: Perl-compatible regular expression library
Group: System Environment/Libraries
@ -46,6 +46,9 @@ Patch4: pcre-8.40-Silent-a-GCC-7-warning-about-too-small-buffer-for-pr.patch
# Fix parsing comments between quantifiers, upstream bug #2019,
# in upstream after 8.40
Patch5: pcre-8.40-Fix-recognition-of-style-comment-between-quantifier-.patch
# Fix a crash in pcretest when printing non-ASCII characters,
# upstream bug #2043, in upstream after 8.40
Patch6: pcre-8.40-Check-character-256-for-isprint-in-pcretest.patch
BuildRequires: readline-devel
BuildRequires: autoconf
BuildRequires: automake
@ -139,6 +142,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
# Because of rpath patch
libtoolize --copy --force
autoreconf -vif
@ -235,6 +239,10 @@ make %{?_smp_mflags} check VERBOSE=yes
%{_mandir}/man1/pcretest.*
%changelog
* Thu Feb 23 2017 Petr Pisar <ppisar@redhat.com> - 8.40-4
- Fix a crash in pcretest when printing non-ASCII characters
(upstream bug #2043)
* Tue Feb 21 2017 Petr Pisar <ppisar@redhat.com> - 8.40-3
- Fix parsing comments between quantifiers (upstream bug #2019)