develooper Front page | perl.perl5.porters | Postings from January 2001

[PATCH] Fix my_pclose segfault

Thread Next
From:
Simon Cozens
Date:
January 10, 2001 10:39
Subject:
[PATCH] Fix my_pclose segfault
Message ID:
20010110183934.A25640@pembro26.pmb.ox.ac.uk
Well, the words "contrived example" may come to mind a little, but:
 % echo | perl -P /dev/fd/0
 zsh: 25630 done                echo | 
 zsh: 25631 segmentation fault  perl -P /dev/fd/0

Here's a fix:

--- util.c~	Wed Jan 10 18:36:19 2001
+++ util.c	Wed Jan 10 18:36:55 2001
@@ -2663,7 +2663,9 @@
     LOCK_FDPID_MUTEX;
     svp = av_fetch(PL_fdpid,PerlIO_fileno(ptr),TRUE);
     UNLOCK_FDPID_MUTEX;
-    pid = SvIVX(*svp);
+    pid = SvIV(*svp);
+    if (!pid)
+        return 0;
     SvREFCNT_dec(*svp);
     *svp = &PL_sv_undef;
 #ifdef OS2

-- 
I've been around the world  // Had my pick of any girl
You'd think I'd be happy    // But I'm not              - Elli Paspala

Thread Next


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