Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #71828] Tie::Hash::NamedCapture::FIRSTKEY(undef) segfaults

0 views
Skip to first unread message

Bjoern Hoehrmann

unread,
Jan 3, 2010, 10:29:11 PM1/3/10
to bugs-bi...@netlabs.develooper.com
# New Ticket Created by Bjoern Hoehrmann
# Please include the string: [perl #71828]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=71828 >


Hi,

perl5.10.1 -e '//;Tie::Hash::NamedCapture::FIRSTKEY(undef)' segfaults.

regards,
--
Björn Höhrmann · mailto:bjo...@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

Nicholas Clark

unread,
Jan 4, 2010, 2:58:16 PM1/4/10
to perl5-...@perl.org
On Sun, Jan 03, 2010 at 07:29:11PM -0800, Bjoern Hoehrmann wrote:
> # New Ticket Created by Bjoern Hoehrmann
> # Please include the string: [perl #71828]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=71828 >
>
>
> Hi,
>
> perl5.10.1 -e '//;Tie::Hash::NamedCapture::FIRSTKEY(undef)' segfaults.

Thanks for the bug report.

With a build of blead with assertions enabled, I see:

$ ./perl -Ilib -e '//;Tie::Hash::NamedCapture::FIRSTKEY(undef)'
perl: universal.c:1500: XS_Tie_Hash_NamedCapture_FIRSTK: Assertion `((svtype)((_svrv)->sv_flags & 0xff)) >= SVt_PV || ((svtype)((_svrv)->sv_flags & 0xff)) == SVt_IV' failed.
Aborted

So the bug is still present.

That line is:

flags = (U32)INT2PTR(IV,SvIV(SvRV(MUTABLE_SV(ST(0)))));

I'm guessing that the problem is that SvRV() is being used without first
checking that SvROK() is true - ie that there is a valid reference to follow.

Nicholas Clark

Nicholas Clark

unread,
Jan 5, 2010, 6:01:02 AM1/5/10
to perl5-...@perl.org
On Mon, Jan 04, 2010 at 07:58:16PM +0000, Nicholas Clark wrote:
> On Sun, Jan 03, 2010 at 07:29:11PM -0800, Bjoern Hoehrmann wrote:
> > # New Ticket Created by Bjoern Hoehrmann
> > # Please include the string: [perl #71828]
> > # in the subject line of all future correspondence about this issue.
> > # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=71828 >
> >
> >
> > Hi,
> >
> > perl5.10.1 -e '//;Tie::Hash::NamedCapture::FIRSTKEY(undef)' segfaults.

> I'm guessing that the problem is that SvRV() is being used without first


> checking that SvROK() is true - ie that there is a valid reference to follow.

Turns out that all the Tie::Hash::NamedCapture routines are similarly
crash-prone, and that a fix is fairly simple, so done in blead as commit
1d021cc8647e49fd860b50abddff99a11b306e2e

Nicholas Clark

0 new messages