Bug #300

Trivial test script crashes perl

Added by wa1ter almost 8 years ago. Updated almost 8 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

This is a followup to my post about pkgsrc packages failing
because of perl crashes. I've spent a few days trying to
narrow down the cause, and the attached perlscript is my
best effort. {I think of it as perl haiku ;o)

Just run 'perl mytest.pl' and watch for the error.

The script itself actually does nothing, so if there is no
output, that means your perl works better than my perl.

I copied the regexp search string from intltool-merge, so
I'm hoping that one of you perl wizards out there can
simplify the regexp to the minimum that will trigger the
crash. (I'm just a perl newbie, so I'm not even sure what
the regexp is searching for.)

The important factor is the number of chars in $str: on my
machine, perl crashes when the string length gets over 1590
characters or so.

mytest.pl Magnifier (1.76 KB) wa1ter, 08/27/2006 10:41 PM

History

#1 Updated by justin almost 8 years ago

On Sun, August 27, 2006 6:32 pm, walt wrote:
> This is a followup to my post about pkgsrc packages failing
> because of perl crashes. I've spent a few days trying to
> narrow down the cause, and the attached perlscript is my
> best effort. {I think of it as perl haiku ;o)
>
> Just run 'perl mytest.pl' and watch for the error.
>

I got no output (as it should be) but no crash on OS X 10.4 or DragonFly
1.4.4. The regex you are using matches zero or more incidences of: either
any single character preceded by a backslash, or any character that isn't
a backslash, and it does so maximally. It produces two matches because of
the parentheses: the whole string, and 'y'.

#2 Updated by qhwt+dfly almost 8 years ago

On Sun, Aug 27, 2006 at 10:21:38PM -0400, Justin C. Sherrill wrote:
> On Sun, August 27, 2006 6:32 pm, walt wrote:
> > This is a followup to my post about pkgsrc packages failing
> > because of perl crashes. I've spent a few days trying to
> > narrow down the cause, and the attached perlscript is my
> > best effort. {I think of it as perl haiku ;o)
> >
> > Just run 'perl mytest.pl' and watch for the error.
> >
>
> I got no output (as it should be) but no crash on OS X 10.4 or DragonFly
> 1.4.4. The regex you are using matches zero or more incidences of: either
> any single character preceded by a backslash, or any character that isn't
> a backslash, and it does so maximally. It produces two matches because of
> the parentheses: the whole string, and 'y'.

You may have to try with longer $str, it needed 2416 bytes
on my mail server(running 1.4.4 with 512MBytes of RAM) for it
to dump core:

$str = "x" x 2416;
if ($str =~ /((\\.|[^\\])*)/) {}

#3 Updated by joerg almost 8 years ago

On Sun, Aug 27, 2006 at 03:32:09PM -0700, walt wrote:
> I copied the regexp search string from intltool-merge, so
> I'm hoping that one of you perl wizards out there can
> simplify the regexp to the minimum that will trigger the
> crash. (I'm just a perl newbie, so I'm not even sure what
> the regexp is searching for.)

It's not really surprising. This regex is testing stack allocation :-)
The culprit in metacity's case is dz.po, but I'll have a look
at fixing intlmerge.

Joerg

#4 Updated by joerg almost 8 years ago

On Sun, Aug 27, 2006 at 03:32:09PM -0700, walt wrote:
> This is a followup to my post about pkgsrc packages failing
> because of perl crashes. I've spent a few days trying to
> narrow down the cause, and the attached perlscript is my
> best effort. {I think of it as perl haiku ;o)

Thanks, the problem should be fixed in intltool-0.35.0nb1.

Joerg

Also available in: Atom PDF