New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] fix crash in gv_fetchmeth_sv #16511
Comments
From @dur-randirCreated by @dur-randirgv_fetchmeth_sv could crash when trying to resolve a non-existent Perl Info
|
From @dur-randir0001-Fix-crash-in-gv_fetchmeth_sv.patchFrom 8710b293a871d049b81d73165766811c7e96e573 Mon Sep 17 00:00:00 2001
From: Sergey Aleynikov <sergey.aleynikov@gmail.com>
Date: Thu, 19 Apr 2018 03:44:46 +0300
Subject: [PATCH] Fix crash in gv_fetchmeth_sv
S_gv_fetchmeth_internal supports it's arguments being either an SV or
a (name, len) pair. But when performing an ISA traversal to get method from
a parent class, it accounted only for the latter.
---
ext/XS-APItest/t/gv_fetchmeth.t | 9 ++++++++-
gv.c | 4 +++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ext/XS-APItest/t/gv_fetchmeth.t b/ext/XS-APItest/t/gv_fetchmeth.t
index 22e8b142b3..9ba1650e8f 100644
--- a/ext/XS-APItest/t/gv_fetchmeth.t
+++ b/ext/XS-APItest/t/gv_fetchmeth.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 43;
+use Test::More tests => 44;
use_ok('XS::APItest');
@@ -70,3 +70,10 @@ ok !XS::APItest::gv_fetchmeth_type(\%::, "method\0not quite!", 3, $level, 0), "g
}
}
}
+
+{
+ @Foo::ISA = qw/Bar/;
+ @Bar::ISA = qw//;
+
+ is(XS::APItest::gv_fetchmeth_type(\%Foo::, "nomethod", 1, -1, 0), undef, 'gv_fetchmeth_sv survives @ISA traversal');
+}
diff --git a/gv.c b/gv.c
index 0dcbabc9ec..085bf7425e 100644
--- a/gv.c
+++ b/gv.c
@@ -804,7 +804,9 @@ S_gv_fetchmeth_internal(pTHX_ HV* stash, SV* meth, const char* name, STRLEN len,
assert(cstash);
- gvp = (GV**)hv_fetch(cstash, name, is_utf8 ? -(I32)len : (I32)len, 0);
+ gvp = (GV**)hv_common(
+ cstash, meth, name, len, is_utf8 ? HVhek_UTF8 : 0, HV_FETCH_JUST_SV, NULL, 0
+ );
if (!gvp) {
if (len > 1 && HvNAMELEN_get(cstash) == 4) {
const char *hvname = HvNAME(cstash); assert(hvname);
--
2.11.0
|
@khwilliamson - Status changed from 'new' to 'open' |
From @khwilliamsonThanks, pushed as |
@khwilliamson - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release yesterday of Perl 5.28.0, this and 185 other issues have been Perl 5.28.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#133121 (status was 'resolved')
Searchable as RT133121$
The text was updated successfully, but these errors were encountered: