Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

Re: [mcoyne] Segmentation Fault!?!?!??

Quote Reply
Re: [mcoyne] Segmentation Fault!?!?!?? In reply to
In case anyone is still using the older version of GM like me (I'm using Version: 2.0.2) - here's a fix for the problem mentioned in this thread.

Code:
Here's a replacement split_line() from GT/Mail/Parts.pm:

sub split_line {
# --------------------------------------------------------------------------
# Class->split_line('\s*,\s*', $line);
# -----------------------------
# Splits a line given a delimitor regex and the line. Returns an array
# of the pieces
#
# We will be testing undef strings
my $class = shift;
local $^W;

my ($delimiter, $line) = @_;
$delimiter =~ s/(\s)/\\$1/g;

my ($quote, $quoted, $unquoted, $delim, $word, @pieces);

@pieces = $line =~ m{
\G
(
(?:
" (?:\\.|[^\\"]+) * "
|
' (?:\\.|[^\\']+) * '
|
\\.
|
.
)+? # May segfault on very long lines (around 8000+ iterations of this group)
)
(?: $ | (?:$delimiter)+ )
}gsx;

return @pieces;
}

It's 'somewhat' fixed because of the regex - but it can handle a much higher length than the older one can.

Cheers

Regan.

Last edited by:

ryel01: Jul 5, 2004, 5:41 PM
Subject Author Views Date
Thread Segmentation Fault!?!?!?? ryel01 5312 Aug 9, 2003, 1:12 PM
Thread Re: [ryel01] Segmentation Fault!?!?!??
ryel01 5072 Aug 13, 2003, 4:07 AM
Thread Re: [ryel01] Segmentation Fault!?!?!??
Inertia 5067 Aug 13, 2003, 12:35 PM
Post Re: [Inertia] Segmentation Fault!?!?!??
ryel01 5054 Aug 13, 2003, 2:14 PM
Thread Re: [Inertia] Segmentation Fault!?!?!??
ryel01 5062 Aug 13, 2003, 2:16 PM
Thread Re: [ryel01] Segmentation Fault!?!?!??
mcoyne 4976 Oct 13, 2003, 1:33 PM
Thread Re: [mcoyne] Segmentation Fault!?!?!??
ryel01 4979 Oct 13, 2003, 1:52 PM
Thread Re: [ryel01] Segmentation Fault!?!?!??
mcoyne 4971 Oct 14, 2003, 6:39 AM
Post Re: [mcoyne] Segmentation Fault!?!?!??
ryel01 4959 Oct 14, 2003, 12:42 PM
Post Re: [mcoyne] Segmentation Fault!?!?!??
ryel01 4812 Jul 5, 2004, 5:40 PM