pcre2/pcre2-10.22-Fix-buffer-overflow-in-partial-match-test-for-CRLF-i.patch

70 lines
1.9 KiB
Diff
Raw Normal View History

From d2c8acf36b8d0654c22787facaf8e9cc34d34aec Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Thu, 8 Dec 2016 17:55:26 +0000
Subject: [PATCH] Fix buffer overflow in partial match test for CRLF in empty
buffer.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Petr Pisar: Ported to 10.22:
commit ec26c8fe3e0a6ee93060ecd7accaa0803dac2ee1
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Thu Dec 8 17:55:26 2016 +0000
Fix buffer overflow in partial match test for CRLF in empty buffer.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@612 6239d852-aaf2-0410-a92c-79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_match.c | 2 +-
testdata/testinput2 | 3 +++
testdata/testoutput2 | 4 ++++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/pcre2_match.c b/src/pcre2_match.c
index 0763a23..09efb49 100644
--- a/src/pcre2_match.c
+++ b/src/pcre2_match.c
@@ -2382,7 +2382,7 @@ for (;;)
case OP_ANY:
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
if (mb->partial != 0 &&
- eptr + 1 >= mb->end_subject &&
+ eptr == mb->end_subject - 1 &&
NLBLOCK->nltype == NLTYPE_FIXED &&
NLBLOCK->nllen == 2 &&
UCHAR21TEST(eptr) == NLBLOCK->nl[0])
diff --git a/testdata/testinput2 b/testdata/testinput2
index 94fbfab..3218cfe 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -4825,4 +4825,7 @@ a)"xI
/(?=.*[A-Z])/I
+/./newline=crlf
+\=ph
+
# End of testinput2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index bdb289d..1776d0d 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -15227,6 +15227,10 @@ Capturing subpattern count = 0
May match empty string
Subject length lower bound = 0
+/./newline=crlf
+\=ph
+No match
+
# End of testinput2
Error -63: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data
--
2.7.4