Project

General

Profile

Actions

Bug #300

closed

Trivial test script crashes perl

Added by wa1ter over 17 years ago. Updated over 17 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

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.


Files

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

Updated by justin about 18 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'.

Actions #2

Updated by qhwt+dfly about 18 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 =~ /((\\.|[^\\])*)/) {}

Actions #3

Updated by joerg about 18 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

Actions #4

Updated by joerg about 18 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

Actions

Also available in: Atom PDF