エラーが発生しています
セグメンテーション違反
次の Perl コードを使用します。
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use Image::ValidJpeg;
my $url = ...
my $ua = LWP::UserAgent->new(agent => '');
my $request = HTTP::Request->new(GET => $url);
my $response = $ua->request($request);
if (($response->is_success) &&
($response->code == 200) &&
($response->header('Content-Type') eq 'image/jpeg'))
{
my $content = $response->decoded_content;
open(my $img, '<', \$content);
my $check = Image::ValidJpeg::check_all($img);
print "$check\n";
}
なぜそのようなエラーですか?私のコードは間違っていますか?
デバッグ情報:
(gdb) run /home/test.pl
Starting program: /home/test.pl
[Thread debugging using libthread_db enabled]
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff683a7e0 in feof () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff683a7e0 in feof () from /lib64/libc.so.6
#1 0x00007ffff5d4af82 in valid_jpeg (fh=0x0, seek_over_entropy=0 '\000') at valid_jpeg.c:50
#2 0x00007ffff5d4a94b in XS_Image__ValidJpeg_check_all (my_perl=<value optimized out>, cv=<value optimized out>) at ValidJpeg.c:138
#3 0x00007ffff7b18805 in Perl_pp_entersub () from /usr/lib64/perl5/CORE/libperl.so
#4 0x00007ffff7b16af6 in Perl_runops_standard () from /usr/lib64/perl5/CORE/libperl.so
#5 0x00007ffff7abf0d8 in perl_run () from /usr/lib64/perl5/CORE/libperl.so
#6 0x0000000000400cac in main ()