Really check that sysread(I, $x, 1, -4) dies with "Offset outside string"
[p5sagit/p5-mst-13.2.git] / t / op / tiearray.t
old mode 100755 (executable)
new mode 100644 (file)
index e7b547b..5ef6bfb
@@ -134,9 +134,20 @@ sub EXISTS {
   exists $ob->[$id];
 }
 
+#
+# Returning -1 from FETCHSIZE used to get casted to U32 causing a
+# segfault
+#
+
+package NegFetchsize;
+
+sub TIEARRAY  { bless [] }
+sub FETCH     { }
+sub FETCHSIZE { -1 }
+
 package main;
   
-print "1..61\n";                   
+print "1..62\n";                   
 my $test = 1;
 
 {my @ary;
@@ -324,6 +335,14 @@ untie @ary;
                            
 
                            
+{
+    tie my @dummy, "NegFetchsize";
+    eval { "@dummy"; };
+    print "# $@" if $@;
+    print "not " unless $@ =~ /^FETCHSIZE returned a negative value/;
+    print "ok ", $test++, " - croak on negative FETCHSIZE\n";
+}
+
 print "not " unless $seen{'DESTROY'} == 3;
 print "ok ", $test++,"\n";