Libc6 malloc bites?

Damien Elmes resolve at repose.cx
Sat Sep 1 14:26:35 EST 2001


hi jeremy,

one of the really nasty things about malloc debugging is that writing
over a previous pointer can hose malloc's data structures. (as someone
mentioned before). this means that the cause of the problem can often
be well away from where the errors are occuring.

of course, if you're using just highligh_block, then chances are it's
a bug in perl.

cheers! :-)

jeremy at itassist.net.au writes:

> On  1 Sep, Tomasz Ciolek wrote:
> 
> >  Perl has its own malloc. Is it possible someone complied the package using perlmalloc and not the Linux malloc?
> > 
> >  I'm not having any problems with perl proggs (wunning current woody)
> 
> I didn't know that Perl has it's own malloc, but I'm sure that it's the
> libc6 one because a gdb backtrace claims that the last call before the
> segfault was to the libc6 malloc (previous email).  Unless it's falling
> over while returning... possible I guess.
> 
> I'm not having any problem with other perl progs, just this one.
> 
> I've posted to PerlMonks and so far noone has said "you're doing a
> terribly bad thing" so I'll keep chipping away at it.
> FWIW, here's the offending code.  Sometimes it's the split, sometimes it's the 
> foreach and sometimes it's the eval that goes.  If I limit $word to be
> under 5 letters it works fine.
> 
> sub highlight_block {
> 	my ($block, $sep, $word)=@_;
> 
> 		#print "Before $word, $sep\n";
> 		my @let = split //, $word;
> 		my @rep;
> 		my $i=1;
> 
> 		 foreach my $l (@let) {$l = "(".$l.")(.{$sep})";push  @rep, '\u$'.$i++.'$'.$i++;};
> 		my $rep = join "", @rep;
> 
> 		my $regexp2 = join "", @let;
> 		my $ev = '$block =~ '."s/$regexp2/$rep/i;";
> 
> 		my $res = eval $ev;
> 		print $res;$block = $res;
> 		print $block, "\n\n";
> 		#print "after\n";
> 		return $block;
> }
> 
> -- 
> I/O, I/O,
> It's off to disk I go,
> A bit or byte to read or write,
> I/O, I/O, I/O...
> 
> 
> 

-- 
Damien Elmes
resolve at repose.cx




More information about the linux mailing list