Fix a crash in pcre2_substitute() function if mcontext argument is NULL

This commit is contained in:
Petr Písař 2019-03-11 12:57:27 +01:00
parent 4beb3e9572
commit 419e370ef0
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From 25c6e08a2c43d50140401e620fff11aa0670effd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 11 Mar 2019 12:52:10 +0100
Subject: [PATCH] Fix a crash in pcre2_substitute() if mcontext is NULL
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A regression introduced in:
commit 3c2c4493cc3b12dddd2493b465f0ce50e3f77b5a
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Tue Sep 18 16:31:30 2018 +0000
Implement callouts from pcre2_substitute().
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1012 6239d852-aaf2-0410-a92c-79f79f948069
causes a crash in pcre2_substitute() if called with a NULL mcontext argument.
This patch ffixes it.
<https://bugs.exim.org/show_bug.cgi?id=2382>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_substitute.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pcre2_substitute.c b/src/pcre2_substitute.c
index 0b46629..0b63ef4 100644
--- a/src/pcre2_substitute.c
+++ b/src/pcre2_substitute.c
@@ -839,7 +839,7 @@ do
remembered. Do the callout if there is one and we have done an actual
replacement. */
- if (!overflowed && mcontext->substitute_callout != NULL)
+ if (!overflowed && mcontext != NULL && mcontext->substitute_callout != NULL)
{
scb.subscount = subs;
scb.output_offsets[1] = buff_offset;
--
2.20.1

View File

@ -9,7 +9,7 @@
%global rcversion RC1 %global rcversion RC1
Name: pcre2 Name: pcre2
Version: 10.33 Version: 10.33
Release: %{?rcversion:0.}1%{?rcversion:.%rcversion}%{?dist} Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist}
%global myversion %{version}%{?rcversion:-%rcversion} %global myversion %{version}%{?rcversion:-%rcversion}
Summary: Perl-compatible regular expression library Summary: Perl-compatible regular expression library
# the library: BSD with exceptions # the library: BSD with exceptions
@ -49,6 +49,9 @@ URL: http://www.pcre.org/
Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%{?rcversion:Testing/}%{name}-%{myversion}.tar.bz2 Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%{?rcversion:Testing/}%{name}-%{myversion}.tar.bz2
# Do no set RPATH if libdir is not /usr/lib # Do no set RPATH if libdir is not /usr/lib
Patch0: pcre2-10.10-Fix-multilib.patch Patch0: pcre2-10.10-Fix-multilib.patch
# Fix a crash in pcre2_substitute() function if mcontext argument is NULL,
# bug #1686434, upstream bug #2382, proposed to upstream
Patch1: pcre2-10.33-RC1-Fix-a-crash-in-pcre2_substitute-if-mcontext-is-NULL.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: coreutils BuildRequires: coreutils
@ -125,6 +128,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%prep %prep
%setup -q -n %{name}-%{myversion} %setup -q -n %{name}-%{myversion}
%patch0 -p1 %patch0 -p1
%patch1 -p1
# Because of multilib patch # Because of multilib patch
libtoolize --copy --force libtoolize --copy --force
autoreconf -vif autoreconf -vif
@ -223,6 +227,10 @@ make %{?_smp_mflags} check VERBOSE=yes
%{_mandir}/man1/pcre2test.* %{_mandir}/man1/pcre2test.*
%changelog %changelog
* Mon Mar 11 2019 Petr Pisar <ppisar@redhat.com> - 10.33-0.2.RC1
- Fix a crash in pcre2_substitute() function if mcontext argument is NULL
(bug #1686434)
* Tue Mar 05 2019 Petr Pisar <ppisar@redhat.com> - 10.33-0.1.RC1 * Tue Mar 05 2019 Petr Pisar <ppisar@redhat.com> - 10.33-0.1.RC1
- 10.33-RC1 bump - 10.33-RC1 bump