develooper Front page | perl.perl5.porters | Postings from March 2003

[PATCH] a :via (kind of) segfault

From:
Jarkko Hietaniemi
Date:
March 27, 2003 23:18
Subject:
[PATCH] a :via (kind of) segfault
Message ID:
20030328071810.GE4403@vipunen.hut.fi
I already applied the below patch, but if someone has better ideas
for a fix...

Change 19077 by jhi@kosh on 2003/03/28 06:03:16

	Feeding illegal QP (like \x80) to this
	./perl -Ilib -wne 'use PerlIO::via::QuotedPrint;BEGIN{binmode(STDIN, ":via(QuotedPrint)")};print'
	caused a coredump in av_length() <- nextargv() because
	the av was NULL.  I don't know that returning Nullfp is
	the best thing to do, but it dodges the segfault and
	introduces no test failures.

Affected files ...

... //depot/perl/doio.c#218 edit

Differences ...

==== //depot/perl/doio.c#218 (text) ====
Index: perl/doio.c
--- perl/doio.c.~1~	Fri Mar 28 09:16:14 2003
+++ perl/doio.c	Fri Mar 28 09:16:14 2003
@@ -717,6 +717,8 @@
 #endif
     }
     PL_filemode = 0;
+    if (!GvAV(gv))
+        return Nullfp;
     while (av_len(GvAV(gv)) >= 0) {
 	STRLEN oldlen;
 	sv = av_shift(GvAV(gv));
End of Patch.

-- 
Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special
biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen



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