Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl-5.10.x + bignum assertion #9747

Closed
p5pRT opened this issue May 28, 2009 · 6 comments
Closed

perl-5.10.x + bignum assertion #9747

p5pRT opened this issue May 28, 2009 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented May 28, 2009

Migrated from rt.perl.org#66098 (status was 'resolved')

Searchable as RT66098$

@p5pRT
Copy link
Author

p5pRT commented May 28, 2009

From @nwc10

Merijn mailed p5p in 20081112130021.70f86340@​pc09.procura.nl
http​://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2008-11/msg00393.html

--8<--- test.pl
use strict;
use warnings;

use bignum;

while (<DATA>) {
  print STDERR;
  my @​x;

  @​x = split m/,/, $_, -1;
  @​x[0..6] = split m/,/, $_, -1;

  my ($dev, $mnt, $size, $used, $free, $fstype, $fill)
  = split m/,/, $_, -1;
  }

__END__
/dev/mapper/isw_daagcejgfe_sva1_part3 ,/ ,461307.1 , 12860.4 ,448446.7 ,ext3
-->8---

$ perl test.pl
Assertion ((svtype)((_svi)->sv_flags & 0xff)) == SVt_IV || ((svtype)((_svi)->sv_flags & 0xff)) >= SVt_PVIV failed​: file "op.c", line 4203 at test.pl line 16.

Dave notes that it appears to be a regression from 588, and doesn't fail in
bleed due to the different way Sv_RVs are done now.

@p5pRT
Copy link
Author

p5pRT commented May 28, 2009

From alex@chmrr.net

On Thu May 28 07​:47​:51 2009, nicholas wrote​:

Dave notes that it appears to be a regression from 588, and doesn't
fail in bleed due to the different way Sv_RVs are done now.

05ef5f8 added this assertion, which
exposes that split wasn't checking that its third argument was SvIOK
before calling SvIVX on it. Patch is attached.
- Alex

@p5pRT
Copy link
Author

p5pRT commented May 28, 2009

From alex@chmrr.net

0001-Fix-RT-66098-stricter-checking-on-SvIVX-exposed-a-la.patch
From 23ed851214bb669bf80d74dd6c1ebcf210233ef7 Mon Sep 17 00:00:00 2001
From: Alex Vandiver <alexmv@mit.edu>
Date: Thu, 28 May 2009 16:27:25 -0400
Subject: [PATCH] Fix [RT#66098] -- stricter checking on SvIVX exposed a lack of SvIOK check

---
 op.c         |    2 +-
 t/op/split.t |    8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/op.c b/op.c
index 246c843..facb884 100644
--- a/op.c
+++ b/op.c
@@ -4298,7 +4298,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
 		      ((LISTOP*)right)->op_last->op_type == OP_CONST)
 		    {
 			SV *sv = ((SVOP*)((LISTOP*)right)->op_last)->op_sv;
-			if (SvIVX(sv) == 0)
+			if (SvIOK(sv) && SvIVX(sv) == 0)
 			    sv_setiv(sv, PL_modcount+1);
 		    }
 		}
diff --git a/t/op/split.t b/t/op/split.t
index 025327f..b3a9741 100755
--- a/t/op/split.t
+++ b/t/op/split.t
@@ -6,7 +6,7 @@ BEGIN {
     require './test.pl';
 }
 
-plan tests => 135;
+plan tests => 136;
 
 $FS = ':';
 
@@ -358,3 +358,9 @@ ok(@ary == 3 &&
     is($s[2]," XYZ");
     is(join(':',@s), join(':',@r));
 }
+
+{
+    use constant BANG => {};
+    () = split m/,/, "", BANG;
+    ok(1);
+}
-- 
1.6.3.204.g8c948

@p5pRT
Copy link
Author

p5pRT commented May 28, 2009

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 28, 2009

From @nwc10

Thanks, applied (b8de32d)

@p5pRT
Copy link
Author

p5pRT commented May 28, 2009

@nwc10 - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant