develooper Front page | perl.perl5.changes | Postings from July 2009

[perl.git] branch blead, updated. GitLive-blead-1683-ge41cc77

From:
Vincent Pit
Date:
July 27, 2009 06:04
Subject:
[perl.git] branch blead, updated. GitLive-blead-1683-ge41cc77
Message ID:
E1MVPs3-0000v7-ON@camel.booking.com
In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/e41cc779424eaf419bea11fb7535e356b1113698?hp=174830c759611b7e2c36d109e8a5529e95868eb0>

- Log -----------------------------------------------------------------
commit e41cc779424eaf419bea11fb7535e356b1113698
Author: Vincent Pit <perl@profvince.com>
Date:   Mon Jul 27 14:47:26 2009 +0200

    Regression test for [perl #67912]

M	t/op/sysio.t

commit 6100a0a495d0f5504fc134f242a1ebed97a87087
Author: chromatic <chromatic@wgz.org>
Date:   Mon Jul 27 14:44:15 2009 +0200

    syswrite prints garbage if called with empty scalar and non-zero offset

M	pp_sys.c
-----------------------------------------------------------------------

Summary of changes:
 pp_sys.c     |    2 +-
 t/op/sysio.t |   15 ++++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/pp_sys.c b/pp_sys.c
index 23f79ba..ec12cd4 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1919,7 +1919,7 @@ PP(pp_send)
 		    DIE(aTHX_ "Offset outside string");
 		}
 		offset += blen_chars;
-	    } else if (offset >= (IV)blen_chars && blen_chars > 0) {
+	    } else if (offset >= (IV)blen_chars) {
 		Safefree(tmpbuf);
 		DIE(aTHX_ "Offset outside string");
 	    }
diff --git a/t/op/sysio.t b/t/op/sysio.t
index dd63a15..b4c2954 100644
--- a/t/op/sysio.t
+++ b/t/op/sysio.t
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..42\n";
+print "1..44\n";
 
 chdir('op') || chdir('t/op') || die "sysio.t: cannot look for myself: $!";
 @INC = '../../lib';
@@ -179,8 +179,6 @@ if ($reopen) {  # must close file to update EOF marker for stat
 print 'not ' unless (-s $outfile == 10);
 print "ok 31\n";
 
-close(O);
-
 open(I, $outfile) || die "sysio.t: cannot read $outfile: $!";
 
 $b = 'xyz';
@@ -240,6 +238,17 @@ unlink $outfile;
 
 chdir('..');
 
+# [perl #67912] syswrite prints garbage if called with empty scalar and non-zero offset
+eval { my $buf = ''; syswrite(O, $buf, 1, 0) };
+print 'not ' unless ($@ =~ /^Offset outside string /);
+print "ok 43\n";
+
+eval { my $buf = 'x'; syswrite(O, $buf, 1, 1) };
+print 'not ' unless ($@ =~ /^Offset outside string /);
+print "ok 44\n";
+
+close(O);
+
 1;
 
 # eof

--
Perl5 Master Repository



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About