Fix a use after free in debugging output of a collation

This commit is contained in:
Petr Písař 2019-08-07 14:18:37 +02:00
parent 7f888313d5
commit f8b2e6830c
2 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,48 @@
From 21dce8f4eb9136875a886371016aa25788f5144f Mon Sep 17 00:00:00 2001
From: Karl Williamson <khw@cpan.org>
Date: Tue, 6 Aug 2019 21:29:22 -0600
Subject: [PATCH] locale.c: Stop Coverity warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Coverity is right, so re-order these clauses. This code is executed
only if some very strange error occurs.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
locale.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/locale.c b/locale.c
index db83d993de..af7af60038 100644
--- a/locale.c
+++ b/locale.c
@@ -4349,11 +4349,6 @@ Perl__mem_collxfrm(pTHX_ const char *input_string,
return xbuf;
bad:
- Safefree(xbuf);
- if (s != input_string) {
- Safefree(s);
- }
- *xlen = 0;
# ifdef DEBUGGING
@@ -4363,6 +4358,12 @@ Perl__mem_collxfrm(pTHX_ const char *input_string,
# endif
+ Safefree(xbuf);
+ if (s != input_string) {
+ Safefree(s);
+ }
+ *xlen = 0;
+
return NULL;
}
--
2.20.1

View File

@ -242,6 +242,10 @@ Patch46: perl-5.31.2-include-a-trailing-0-in-SVs-holding-trie-info.patch
# Fix a use after free in /(?{...})/, RT#134208, fixed after 5.31.2
Patch47: perl-5.31.2-avoid-use-after-free-in.patch
# Fix a use after free in debugging output of a collation,
# in upstream after 5.31.2
Patch48: perl-5.31.2-locale.c-Stop-Coverity-warning.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -2811,6 +2815,7 @@ Perl extension for Version Objects
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch200 -p1
%patch201 -p1
@ -2865,6 +2870,7 @@ perl -x patchlevel.h \
'Fedora Patch45: Fix propagating non-string variables in an exception value (RT#134291)' \
'Fedora Patch46: Include trailing zero in scalars holding trie data (RT#134207)' \
'Fedora Patch47: Fix a use after free in /(?{...})/ (RT#134208)' \
'Fedora Patch48: Fix a use after free in debugging output of a collation' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil}
@ -5114,6 +5120,7 @@ popd
- Fix propagating non-string variables in an exception value (RT#134291)
- Include trailing zero in scalars holding trie data (RT#134207)
- Fix a use after free in /(?{...})/ (RT#134208)
- Fix a use after free in debugging output of a collation
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4:5.30.0-442
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild