[Reproducible-commits] [perl] 02/36: fix cloning arrays with unused elements

Mattia Rizzolo mattia at mapreri.org
Tue Nov 17 14:00:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

mapreri-guest pushed a commit to branch pu/reproducible_builds
in repository perl.

commit 94e7ac6276ca6721f6b8e8077c97274967d9ee2b
Author: Tony Cook <tony at develop-help.com>
Date:   Tue Apr 14 15:59:03 2015 +1000

    fix cloning arrays with unused elements
    
    ce0d59fd changed arrays to use NULL instead of &PL_sv_undef for
    unused elements, unfortunately it missed updating sv_dup_common()'s
    initialization of unused elements, leaving them as &PL_sv_undef.
    
    This resulted in modification of read only value errors at runtime.
    
    Origin: upstream, http://perl5.git.perl.org/perl.git/commit/902d16915db2735c3a41f15ef8d95cf300c31801
    Bug: https://rt.perl.org/Public/Bug/Display.html?id=124127
    Bug-Debian: https://bugs.debian.org/779357
    Patch-Name: fixes/array-cloning.diff
---
 sv.c           | 2 +-
 t/op/threads.t | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/sv.c b/sv.c
index af393bd..06db7d9 100644
--- a/sv.c
+++ b/sv.c
@@ -12698,7 +12698,7 @@ S_sv_dup_common(pTHX_ const SV *const sstr, CLONE_PARAMS *const param)
 		    }
 		    items = AvMAX((const AV *)sstr) - AvFILLp((const AV *)sstr);
 		    while (items-- > 0) {
-			*dst_ary++ = &PL_sv_undef;
+			*dst_ary++ = NULL;
 		    }
 		}
 		else {
diff --git a/t/op/threads.t b/t/op/threads.t
index 67b5f4a..bec210b 100644
--- a/t/op/threads.t
+++ b/t/op/threads.t
@@ -9,7 +9,7 @@ BEGIN {
      skip_all_without_config('useithreads');
      skip_all_if_miniperl("no dynamic loading on miniperl, no threads");
 
-     plan(27);
+     plan(28);
 }
 
 use strict;
@@ -403,4 +403,10 @@ fresh_perl_is(
   'no crash when deleting $::{INC} in thread'
 );
 
+fresh_perl_is(<<'CODE', 'ok', 'no crash modifying extended array element');
+use threads;
+my @a = 1;
+threads->create(sub { $#a = 1; $a[1] = 2; print qq/ok\n/ })->join;
+CODE
+
 # EOF

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/perl.git



More information about the Reproducible-commits mailing list