Change 33239 by [EMAIL PROTECTED] on 2008/02/06 01:00:43

        in unpack, () groups in scalar context were still returning a list,
        resulting in garbage on the stack, which could manifest as a SEGV
        (Bug 50256)

Affected files ...

... //depot/perl/pp_pack.c#141 edit
... //depot/perl/t/op/pack.t#115 edit

Differences ...

==== //depot/perl/pp_pack.c#141 (text) ====
Index: perl/pp_pack.c
--- perl/pp_pack.c#140~32821~   2008-01-03 17:06:10.000000000 -0800
+++ perl/pp_pack.c      2008-02-05 17:00:43.000000000 -0800
@@ -1258,6 +1258,7 @@
            symptr->previous = &savsym;
             symptr->level++;
            PUTBACK;
+           if (len && unpack_only_one) len = 1;
            while (len--) {
                symptr->patptr = savsym.grpbeg;
                if (utf8) symptr->flags |=  FLAG_PARSE_UTF8;

==== //depot/perl/t/op/pack.t#115 (xtext) ====
Index: perl/t/op/pack.t
--- perl/t/op/pack.t#114~32072~ 2007-10-08 08:59:55.000000000 -0700
+++ perl/t/op/pack.t    2008-02-05 17:00:43.000000000 -0800
@@ -12,7 +12,7 @@
 my $no_signedness = $] > 5.009 ? '' :
   "Signed/unsigned pack modifiers not available on this perl";
 
-plan tests => 14696;
+plan tests => 14697;
 
 use strict;
 use warnings qw(FATAL all);
@@ -1980,3 +1980,8 @@
     is(unpack('@!4 a*', "\x{301}\x{302}\x{303}\x{304}\x{305}"),
        "\x{303}\x{304}\x{305}", 'Test basic utf8 @!');
 }
+{
+    #50256
+    my ($v) = split //, unpack ('(B)*', 'ab');
+    is($v, 0); # Doesn't SEGV :-)
+}
End of Patch.

Reply via email to