pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / development / perl-modules / boost-geometry-utils-fix-oom.patch
blobcbcce381989610225ed557f5db942a00fc247a62
1 From a46f0e41056b48a56c572fe8884d4b5104a8343e Mon Sep 17 00:00:00 2001
2 From: Niko Tyni <ntyni@debian.org>
3 Date: Sun, 29 Jun 2014 21:51:15 +0300
4 Subject: [PATCH] multi_linestring2perl: only extend the array if needed
6 When the size is 0, we end up extending the stack with
7 a negative value. As of Perl 5.19.4, more precisely
8 http://perl5.git.perl.org/perl.git/commit/fc16c3924bd6aa054f21ad5445fecf9b7f39dc36
9 this ends up allocating memory for 4G-1 elements.
11 See Dave Mitchell's comments on perl5-porters:
12 Message-ID: <20140522115758.GX15438@iabyn.com>
13 http://marc.info/?l=perl5-porters&m=140075990913228&w=2
14 ---
15 src/mline2av.h | 3 ++-
16 1 file changed, 2 insertions(+), 1 deletion(-)
18 diff --git a/src/mline2av.h b/src/mline2av.h
19 index e4b3fc2..d7bacee 100644
20 --- a/src/mline2av.h
21 +++ b/src/mline2av.h
22 @@ -9,7 +9,8 @@ multi_linestring2perl(pTHX_ const multi_linestring& mls)
24 AV* av = newAV();
25 const unsigned int size = mls.size();
26 - av_extend(av, size-1);
27 + if (size > 0)
28 + av_extend(av, size-1);
30 for (int i = 0; i < size; i++) {
31 AV* lineav = newAV();
32 --
33 2.0.0