Skip Menu |

This queue is for tickets about the Encode CPAN distribution.

Report information
The Basics
Id: 65796
Status: resolved
Priority: 0/
Queue: Encode

People
Owner: Nobody in particular
Requestors: JGMYERS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 2.18
  • 2.42
Fixed in: (no value)



Subject: Deep recursion error finding invalid charset
Encode::find_encoding() of a charset with lots of spaces causes a perl stack overflow. Test case attached to this ticket.
Subject: badcharset.t
#!/bin/perl use Test::More no_plan; use strict; use warnings; use Encode; sub backtrace(;$) { my $level = shift() || 1; my $rv = ''; my ($last_package, undef, $last_line) = caller(++$level); my ($package, $line, $subroutine); while (($package, undef, $line, $subroutine) = caller(++$level)) { $subroutine = $last_package . $subroutine if ($subroutine =~ /^\(/); $rv .= " " if ($rv); $rv .= "${subroutine}[$last_line]"; $last_package = $package; $last_line = $line; } return $rv; } { local $SIG{__WARN__} = sub { fail("warning: $_[0]"); diag(backtrace()."\n")}; my $decoder = Encode::find_encoding('x'.(" x" x 1000)); }
Thank you for your report. Since there is no space in encoding names or aliases, this bug is now resolved by simply getting rid of \s from the input. Dan the Maintainer Thereof On Wed Feb 16 17:34:21 2011, JGMYERS wrote: Show quoted text
> Encode::find_encoding() of a charset with lots of spaces causes a perl > stack overflow. > > Test case attached to this ticket.