Fix a crash in pcre2test when displaying a wide character with a set locate
This commit is contained in:
parent
25ee885883
commit
6616684983
@ -0,0 +1,112 @@
|
|||||||
|
From 953d56f59bb13f5d6ebef31597b48e446659f368 Mon Sep 17 00:00:00 2001
|
||||||
|
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
|
||||||
|
Date: Thu, 8 Dec 2016 18:56:24 +0000
|
||||||
|
Subject: [PATCH] Fix crash in pcre2test when displaying a wide character with
|
||||||
|
a locale set.
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Petr Pisar: Ported to 10.22:
|
||||||
|
|
||||||
|
commit f35783211054aec20925a2efdf936a00d12db0df
|
||||||
|
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
|
||||||
|
Date: Thu Dec 8 18:56:24 2016 +0000
|
||||||
|
|
||||||
|
Fix crash in pcre2test when displaying a wide character with a locale set.
|
||||||
|
|
||||||
|
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@613 6239d852-aaf2-0410-a92c-
|
||||||
|
79f79f948069
|
||||||
|
|
||||||
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||||
|
---
|
||||||
|
src/pcre2test.c | 8 ++++----
|
||||||
|
testdata/testinput5 | 11 +++++++++++
|
||||||
|
testdata/testoutput5 | 13 +++++++++++++
|
||||||
|
3 files changed, 28 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/pcre2test.c b/src/pcre2test.c
|
||||||
|
index 96d9075..48b0f27 100644
|
||||||
|
--- a/src/pcre2test.c
|
||||||
|
+++ b/src/pcre2test.c
|
||||||
|
@@ -211,7 +211,7 @@ systems that differ in their output from isprint() even in the "C" locale. */
|
||||||
|
#define PRINTABLE(c) ((c) >= 32 && (c) < 127)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#define PRINTOK(c) ((locale_tables != NULL)? isprint(c) : PRINTABLE(c))
|
||||||
|
+#define PRINTOK(c) ((use_tables != NULL && c < 256)? isprint(c) : PRINTABLE(c))
|
||||||
|
|
||||||
|
/* We have to include some of the library source files because we need
|
||||||
|
to use some of the macros, internal structure definitions, and other internal
|
||||||
|
@@ -823,6 +823,7 @@ static regex_t preg = { NULL, NULL, 0, 0, 0 };
|
||||||
|
|
||||||
|
static int *dfa_workspace = NULL;
|
||||||
|
static const uint8_t *locale_tables = NULL;
|
||||||
|
+static const uint8_t *use_tables = NULL;
|
||||||
|
static uint8_t locale_name[32];
|
||||||
|
|
||||||
|
/* We need buffers for building 16/32-bit strings; 8-bit strings don't need
|
||||||
|
@@ -4464,7 +4465,6 @@ process_pattern(void)
|
||||||
|
BOOL utf;
|
||||||
|
uint32_t k;
|
||||||
|
uint8_t *p = buffer;
|
||||||
|
-const uint8_t *use_tables;
|
||||||
|
unsigned int delimiter = *p++;
|
||||||
|
int errorcode;
|
||||||
|
void *use_pat_context;
|
||||||
|
@@ -4922,8 +4922,8 @@ if ((pat_patctl.control & CTL_NL_SET) == 0 && local_newline_default != 0)
|
||||||
|
SETFLD(pat_context, newline_convention, local_newline_default);
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* The nullcontext modifier is used to test calling pcre2_compile() with a NULL
|
||||||
|
-context. */
|
||||||
|
+/* The null_context modifier is used to test calling pcre2_compile() with a
|
||||||
|
+NULL context. */
|
||||||
|
|
||||||
|
use_pat_context = ((pat_patctl.control & CTL_NULLCONTEXT) != 0)?
|
||||||
|
NULL : PTR(pat_context);
|
||||||
|
diff --git a/testdata/testinput5 b/testdata/testinput5
|
||||||
|
index 461302a..e9b4d83 100644
|
||||||
|
--- a/testdata/testinput5
|
||||||
|
+++ b/testdata/testinput5
|
||||||
|
@@ -1727,4 +1727,15 @@
|
||||||
|
/../utf,auto_callout
|
||||||
|
\n\x{123}\x{123}\x{123}\x{123}
|
||||||
|
|
||||||
|
+# These three test a bug fix that was not clearing up after a locale setting
|
||||||
|
+# when the test or a subsequent one matched a wide character.
|
||||||
|
+
|
||||||
|
+//locale=C
|
||||||
|
+
|
||||||
|
+/[\P{Yi}]/utf
|
||||||
|
+\x{2f000}
|
||||||
|
+
|
||||||
|
+/[\P{Yi}]/utf,locale=C
|
||||||
|
+\x{2f000}
|
||||||
|
+
|
||||||
|
# End of testinput5
|
||||||
|
diff --git a/testdata/testoutput5 b/testdata/testoutput5
|
||||||
|
index e661033..993aba0 100644
|
||||||
|
--- a/testdata/testoutput5
|
||||||
|
+++ b/testdata/testoutput5
|
||||||
|
@@ -4169,4 +4169,17 @@ No match
|
||||||
|
+2 ^ ^
|
||||||
|
0: \x{123}\x{123}
|
||||||
|
|
||||||
|
+# These three test a bug fix that was not clearing up after a locale setting
|
||||||
|
+# when the test or a subsequent one matched a wide character.
|
||||||
|
+
|
||||||
|
+//locale=C
|
||||||
|
+
|
||||||
|
+/[\P{Yi}]/utf
|
||||||
|
+\x{2f000}
|
||||||
|
+ 0: \x{2f000}
|
||||||
|
+
|
||||||
|
+/[\P{Yi}]/utf,locale=C
|
||||||
|
+\x{2f000}
|
||||||
|
+ 0: \x{2f000}
|
||||||
|
+
|
||||||
|
# End of testinput5
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
@ -64,6 +64,9 @@ Patch13: pcre2-10.22-Fix-small-memory-leak-in-error-code-path.patch
|
|||||||
# Fix a buffer overflow in partial match test for CRLF in an empty buffer,
|
# Fix a buffer overflow in partial match test for CRLF in an empty buffer,
|
||||||
# in upsteam after 10.22, upstream bug #1975
|
# in upsteam after 10.22, upstream bug #1975
|
||||||
Patch14: pcre2-10.22-Fix-buffer-overflow-in-partial-match-test-for-CRLF-i.patch
|
Patch14: pcre2-10.22-Fix-buffer-overflow-in-partial-match-test-for-CRLF-i.patch
|
||||||
|
# Fix a crash in pcre2test when displaying a wide character with a set locate,
|
||||||
|
# in upstream after 10.22, upstream bug #1976
|
||||||
|
Patch15: pcre2-10.22-Fix-crash-in-pcre2test-when-displaying-a-wide-charac.patch
|
||||||
# New libtool to get rid of RPATH and to use distribution autotools
|
# New libtool to get rid of RPATH and to use distribution autotools
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
@ -155,6 +158,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
|
|||||||
%patch12 -p1
|
%patch12 -p1
|
||||||
%patch13 -p1
|
%patch13 -p1
|
||||||
%patch14 -p1
|
%patch14 -p1
|
||||||
|
%patch15 -p1
|
||||||
# Because of multilib patch
|
# Because of multilib patch
|
||||||
libtoolize --copy --force
|
libtoolize --copy --force
|
||||||
autoreconf -vif
|
autoreconf -vif
|
||||||
@ -256,6 +260,8 @@ make %{?_smp_mflags} check VERBOSE=yes
|
|||||||
- Fix a memory leak and a typo in a documentation (upstream bug #1973)
|
- Fix a memory leak and a typo in a documentation (upstream bug #1973)
|
||||||
- Fix a buffer overflow in partial match test for CRLF in an empty buffer
|
- Fix a buffer overflow in partial match test for CRLF in an empty buffer
|
||||||
(upstream bug #1975)
|
(upstream bug #1975)
|
||||||
|
- Fix a crash in pcre2test when displaying a wide character with a set locate
|
||||||
|
(upstream bug #1976)
|
||||||
|
|
||||||
* Tue Nov 08 2016 Petr Pisar <ppisar@redhat.com> - 10.22-6
|
* Tue Nov 08 2016 Petr Pisar <ppisar@redhat.com> - 10.22-6
|
||||||
- Fix faulty auto-anchoring patterns when .* is inside an assertion
|
- Fix faulty auto-anchoring patterns when .* is inside an assertion
|
||||||
|
Loading…
Reference in New Issue
Block a user