SlickEdit Community

Archived Read Only Forums => SlickEdit 2014 v19 beta => Topic started by: warnerrs on September 17, 2014, 09:36:18 pm

Title: B5: segfault using perl debugger with large scalar
Post by: warnerrs on September 17, 2014, 09:36:18 pm
Slick segfaulted while I was stepping through a perl script. I had a scalar variable which contained a very large multi-line value. It was the contents of an XML file. When I hovered over the variable to see the value, Slick momentarily froze, then core dumped. The file size is about 5K.
Title: Re: B5: segfault using perl debugger with large scalar
Post by: Clark on September 17, 2014, 09:40:14 pm
Are you able to reproduce this every time? Could you provide a small bit of perl source? If this is a size issue, we can use our own XML sample files. Thanks
Title: Re: B5: segfault using perl debugger with large scalar
Post by: warnerrs on September 18, 2014, 04:27:56 pm
Definitely a buffer overflow.  If I step over either of the lines indicated in this function, the segfault happens. Sometimes it might not happen until you step on the following line.  One time when I did this, the editor window contents got partially corrupted, but slick kept on running for a few more steps before it finally segfaulted.

Code: [Select]
use Test::More;
sub is_golden {
    my ($actual_file, $golden_file, $msg) = @_;
    local $/ = undef;
    my $golden;
    if ( -e $golden_file ) {
        open( GOLD, "<$golden_file" ) or die "Could not open $golden_file: $!\n";
        $golden = <GOLD>; # <---- happens when you step over this line
        close( GOLD );
    }

    if ( ! open( GOT, "<$actual_file" ) ) {
        fail( "Can't open $actual_file: $!\n" );
        next;
    }
    my $got = <GOT>; # <---- or happens when you step over this line
    if ( ! ( is( $got, $golden, $msg) or diag( "See: $golden_file.actual" ) ) ) {
        open( ACT, ">$golden_file.actual" ) or die $!;
        print ACT $got;
        close( ACT );
    }
}
Title: Re: B5: segfault using perl debugger with large scalar
Post by: Clark on September 23, 2014, 11:40:49 pm
What platform are you on and what version of Perl are you using?
Title: Re: B5: segfault using perl debugger with large scalar
Post by: Rodney on September 24, 2014, 12:05:14 am
Patrick fixed this for the next build: http://community.slickedit.com/index.php/topic,10486.0.html (http://community.slickedit.com/index.php/topic,10486.0.html)