-
Notifications
You must be signed in to change notification settings - Fork 550
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
Tricky code can bypass Carp overload protections and trigger exceptions #16407
Comments
From @demerphqThis produces interesting results: perl -MCarp -E 'package OverloadedInXS { my $n = \&overload::nil; my at -e line 1. So one can get around Carp's defenses against overloading. Which means... perl -MCarp -E 'package OverloadedInXS { my $n = \&overload::nil; my This applies to the most recent perl as well. The following patch, Inline Patchdiff --git a/dist/Carp/lib/Carp.pm b/dist/Carp/lib/Carp.pm
index f4ae975..6d4df6e 100644
--- a/dist/Carp/lib/Carp.pm
+++ b/dist/Carp/lib/Carp.pm
@@ -322,6 +322,11 @@ sub format_arg {
}
else
{
+ {
+ no strict 'refs';
+ my $pack= ref $arg;
+ if (*{$pack."::(("}{CODE}) { require overload; }
+ }
my $sub = _fetch_sub(overload => 'StrVal');
return $sub ? &$sub($arg) : "$arg";
}
Yves -- |
From @demerphqOn 7 February 2018 at 21:56, yves orton <perlbug-followup@perl.org> wrote:
Simplifies to: perl -MCarp -E 'my $p = "OverloadedInXS"; *{$p."::(("} = sub{};
-- |
From @demerphqOn 7 February 2018 at 22:09, demerphq <demerphq@gmail.com> wrote:
Fixed in c99363a Please don't close the ticket until i can push a patch for testing. thanks, -- |
@jkeenan - Status changed from 'new' to 'open' |
From @demerphqOn 23 February 2018 at 10:33, demerphq <demerphq@gmail.com> wrote:
Pushed as b20e410 Yves -- |
Migrated from rt.perl.org#132828 (status was 'open')
Searchable as RT132828$
The text was updated successfully, but these errors were encountered: