Author Topic: B5: segfault using perl debugger with large scalar  (Read 1259 times)

warnerrs

  • Senior Community Member
  • Posts: 114
  • Hero Points: 4
B5: segfault using perl debugger with large scalar
« 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.

Clark

  • Moderator
  • Senior Community Member
  • *
  • Posts: 4736
  • Hero Points: 382
Re: B5: segfault using perl debugger with large scalar
« Reply #1 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

warnerrs

  • Senior Community Member
  • Posts: 114
  • Hero Points: 4
Re: B5: segfault using perl debugger with large scalar
« Reply #2 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 );
    }
}

Clark

  • Moderator
  • Senior Community Member
  • *
  • Posts: 4736
  • Hero Points: 382
Re: B5: segfault using perl debugger with large scalar
« Reply #3 on: September 23, 2014, 11:40:49 pm »
What platform are you on and what version of Perl are you using?

Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 738
  • Hero Points: 47
Re: B5: segfault using perl debugger with large scalar
« Reply #4 on: September 24, 2014, 12:05:14 am »
« Last Edit: September 24, 2014, 01:06:55 am by Clark »