cpanel / perl-compiler

cPanel's custom implementation of B::C
https://cpanel.net
Other
8 stars 3 forks source link

sprintf does not convert UTF8 to \x{..} format when emitting in B::C #67

Open toddr opened 7 years ago

toddr commented 7 years ago

WARNING: this program MUST be in a file in UTF-8 mode, NOT Latin1

use utf8;
use warnings;

my $msg = "";
$SIG{__WARN__} = sub { $msg = shift };

sub SKRÈÈÈ;

my $victim = sprintf("%d", *SKRÈÈÈ);
$msg =~ m/Argument "\*main::SKR\\x\{c8}\\x\{c8}\\x\{c8}" isn.t numeric in sprintf/ and print "ok\n";
binmode STDOUT, ":utf8";
print "got=$msg\n"

when run with pure perl, you get:

ok
got=Argument "*main::SKR\x{c8}\x{c8}\x{c8}" isn't numeric in sprintf at foo.pl line 9.

when run with B::C, you get:

got=Argument "*main::SKRÈÈÈ" isn't numeric in sprintf at foo.pl line 9.