develooper Front page | perl.perl5.porters | Postings from June 2008

Re: [perl #54828] perlio.c has a problem (both 5.8 and 5.10)

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
June 1, 2008 07:07
Subject:
Re: [perl #54828] perlio.c has a problem (both 5.8 and 5.10)
Message ID:
b77c1dce0806010707g55f40cefl7be030eac692028e@mail.gmail.com
2008/5/26 via RT Goro Fuji <perlbug-followup@perl.org>:
> I think perlio.c has an issue in PerlIORaw_pushed().
> It may cause segmentation fault or invalid abortion in (at least)
> MSWin32 ActivePerl 5.10.0 and Cygwin Perl 5.8.8 and 5.10.0.
>
> The problem is that PerlIORaw_pushed() may supply a layer's Binmode()
> with an invalid function table. See the line 1293 at perlio.c of
> 5.10.0. At the line, Binmode() is called with "f", not "t". It seems a
> mistake, because the argument is the method recerver, namely "self",
> which has to match with the function. This is "t"'s Binmode() (==
> "&l"'s) function, so the argument should be "t".

I agree with this.

> I have written a patch and test. Please see the attached.

Good catch. I've applied the first chunk of the patch (see below). I
don't understand why the 2nd chunk is needed, and I don't have a Win32
machine to test with, so I'd like another pair of eyes to look at
this.

(PS. Please send patches as the output of diff -u, for easier review
and application).

Change 33978 by rgs@scipion on 2008/06/01 14:05:16

        Subject: [perl #54828] perlio.c has a problem (both 5.8 and 5.10)
        From: "Goro Fuji" (via RT) <perlbug-followup@perl.org>
        Date: Sun, 25 May 2008 23:10:42 -0700
        Message-ID: <rt-3.6.HEAD-11257-1211782242-1590.54828-75-0@perl.org>

        First chunk of the patch only

Affected files ...

... //depot/perl/perlio.c#387 edit

Differences ...

==== //depot/perl/perlio.c#387 (text) ====

@@ -1295,7 +1295,7 @@
        while (t && (l = *t)) {
            if (l->tab->Binmode) {
                /* Has a handler - normal case */
-               if ((*l->tab->Binmode)(aTHX_ f) == 0) {
+               if ((*l->tab->Binmode)(aTHX_ t) == 0) {
                    if (*t == l) {
                        /* Layer still there - move down a layer */
                        t = PerlIONext(t);

Thread Previous | 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