[perl-Boost-Geometry-Utils] Fix for Perl 5.20 (RT#96145)

Jitka Plesnikova jplesnik at fedoraproject.org
Mon Aug 4 08:00:03 UTC 2014


commit 3a8e937b065e7681f9ec0d000c3476e8349a5591
Author: Jitka Plesnikova <jplesnik at redhat.com>
Date:   Mon Aug 4 09:59:53 2014 +0200

    Fix for Perl 5.20 (RT#96145)

 ...ring2perl-only-extend-the-array-if-needed.patch |   34 ++++++++++++++++++++
 perl-Boost-Geometry-Utils.spec                     |    8 ++++-
 2 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/Boost-Geometry-Utils-0.15-multi_linestring2perl-only-extend-the-array-if-needed.patch b/Boost-Geometry-Utils-0.15-multi_linestring2perl-only-extend-the-array-if-needed.patch
new file mode 100644
index 0000000..cbcce38
--- /dev/null
+++ b/Boost-Geometry-Utils-0.15-multi_linestring2perl-only-extend-the-array-if-needed.patch
@@ -0,0 +1,34 @@
+From a46f0e41056b48a56c572fe8884d4b5104a8343e Mon Sep 17 00:00:00 2001
+From: Niko Tyni <ntyni at debian.org>
+Date: Sun, 29 Jun 2014 21:51:15 +0300
+Subject: [PATCH] multi_linestring2perl: only extend the array if needed
+
+When the size is 0, we end up extending the stack with
+a negative value. As of Perl 5.19.4, more precisely
+ http://perl5.git.perl.org/perl.git/commit/fc16c3924bd6aa054f21ad5445fecf9b7f39dc36
+this ends up allocating memory for 4G-1 elements.
+
+See Dave Mitchell's comments on perl5-porters:
+ Message-ID: <20140522115758.GX15438 at iabyn.com>
+ http://marc.info/?l=perl5-porters&m=140075990913228&w=2
+---
+ src/mline2av.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/mline2av.h b/src/mline2av.h
+index e4b3fc2..d7bacee 100644
+--- a/src/mline2av.h
++++ b/src/mline2av.h
+@@ -9,7 +9,8 @@ multi_linestring2perl(pTHX_ const multi_linestring& mls)
+ {
+   AV* av = newAV();
+   const unsigned int size = mls.size();
+-  av_extend(av, size-1);
++  if (size > 0)
++    av_extend(av, size-1);
+ 
+   for (int i = 0; i < size; i++) {
+     AV* lineav = newAV();
+-- 
+2.0.0
+
diff --git a/perl-Boost-Geometry-Utils.spec b/perl-Boost-Geometry-Utils.spec
index b04ed95..a0e1918 100644
--- a/perl-Boost-Geometry-Utils.spec
+++ b/perl-Boost-Geometry-Utils.spec
@@ -1,11 +1,13 @@
 Name:           perl-Boost-Geometry-Utils
 Version:        0.15
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        Boost::Geometry::Utils Perl module
 License:        GPL+ or Artistic
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Boost-Geometry-Utils/
 Source0:        http://www.cpan.org/authors/id/A/AA/AAR/Boost-Geometry-Utils-%{version}.tar.gz
+# Fix for RT#96145
+Patch0:         Boost-Geometry-Utils-0.15-multi_linestring2perl-only-extend-the-array-if-needed.patch
 BuildRequires:  perl(Exporter)
 BuildRequires:  perl(ExtUtils::Typemaps::Default)
 BuildRequires:  perl(File::Temp)
@@ -22,6 +24,7 @@ Boost::Geometry::Utils Perl module
 
 %prep
 %setup -q -n Boost-Geometry-Utils-%{version}
+%patch0 -p1
 
 %build
 perl Build.PL installdirs=vendor optimize="$RPM_OPT_FLAGS"
@@ -43,6 +46,9 @@ find %{buildroot} -type f -name '*.bs' -size 0 -exec rm -f {} \;
 %{_mandir}/man3/*
 
 %changelog
+* Mon Aug 04 2014 Jitka Plesnikova <jplesnik at redhat.com> - 0.15-5
+- Fix for Perl 5.20 (RT#96145)
+
 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.15-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 



More information about the perl-devel mailing list