jihong.cai has asked for the wisdom of the Perl Monks concerning the following question:

The following perl script causes segmentation fault. Is there a way to fix or work around?

use Net::ADNS qw(ADNS_R_A ADNS_R_A); $adns = Net::ADNS->new; use Data::Dumper; my $query = $adns->submit("pwarez.6x.to", ADNS_R_A) or die "$!"; $query->{user} = 'my data'; my ($r, $w, $e, $t) = $adns->before_select; if (select($r, $w, $e, $t)) { if (my $answer = $adns->check) { print "resolved query: ", Dumper $answer; } }

perl version: perl-5.8.8-38.el5

perl adns: Net-ADNS-0.03.tar.gz

The script works perfect if the host is www.google.com Ran valgrind perl SCRIPT:

==8942== Process terminating with default action of signal 11 (SIGSEGV +) ==8942== Access not within mapped region at address 0x8 ==8942== at 0x4097D17: Perl_sv_unmagic (in /usr/lib/perl5/5.8.8/i38 +6-linux-thread-multi/CORE/libperl.so) ==8942== by 0x413FD9A: XS_Net__ADNS_DESTROY (ADNS.xs:346) ==8942== by 0x409258C: Perl_pp_entersub (in /usr/lib/perl5/5.8.8/i3 +86-linux-thread-multi/CORE/libperl.so) ==8942== by 0x402C0A0: ??? (in /usr/lib/perl5/5.8.8/i386-linux-thre +ad-multi/CORE/libperl.so) ==8942== by 0x4030945: Perl_call_sv (in /usr/lib/perl5/5.8.8/i386-l +inux-thread-multi/CORE/libperl.so) ==8942== by 0x4097153: Perl_sv_clear (in /usr/lib/perl5/5.8.8/i386- +linux-thread-multi/CORE/libperl.so) ==8942== by 0x40979B4: Perl_sv_free (in /usr/lib/perl5/5.8.8/i386-l +inux-thread-multi/CORE/libperl.so) ==8942== by 0x4097F5D: ??? (in /usr/lib/perl5/5.8.8/i386-linux-thre +ad-multi/CORE/libperl.so) ==8942== by 0x4094D7F: ??? (in /usr/lib/perl5/5.8.8/i386-linux-thre +ad-multi/CORE/libperl.so) ==8942== by 0x4094DE9: Perl_sv_clean_objs (in /usr/lib/perl5/5.8.8/ +i386-linux-thread-multi/CORE/libperl.so) ==8942== by 0x403297A: perl_destruct (in /usr/lib/perl5/5.8.8/i386- +linux-thread-multi/CORE/libperl.so) ==8942== by 0x80491C6: main (in /usr/bin/perl)

Replies are listed 'Best First'.
Re: Net::ADNS Segmentation fault
by Anonymous Monk on Apr 19, 2012 at 05:12 UTC