Commit | Line | Data |
3357b1b1 |
1 | # Digest::MD5 2.07 and older used to trigger a core dump when |
2 | # passed an illegal file handle that failed to open. |
3 | |
ac70dec1 |
4 | print "1..3\n"; |
3357b1b1 |
5 | |
6 | use Digest::MD5 (); |
7 | |
8 | $md5 = Digest::MD5->new; |
9 | |
10 | eval { |
11 | use vars qw(*FOO); |
12 | $md5->addfile(*FOO); |
13 | }; |
ac70dec1 |
14 | print "not " unless $@ =~ /^Bad filehandle: FOO at/; |
3357b1b1 |
15 | print "ok 1\n"; |
16 | |
ac70dec1 |
17 | open(BAR, "no-existing-file.$$"); |
18 | eval { |
19 | $md5->addfile(*BAR); |
20 | }; |
21 | print "not " unless $@ =~ /^No filehandle passed at/; |
3357b1b1 |
22 | print "ok 2\n"; |
ac70dec1 |
23 | |
24 | open(BAR, ">no-existing-file.$$") || die; |
25 | eval { |
26 | $md5->addfile(*BAR); |
27 | }; |
263df5f1 |
28 | print "not " unless $@ =~ /^Reading from filehandle failed at/; |
ac70dec1 |
29 | print "ok 3\n"; |
30 | |
31 | close(BAR); |
32 | unlink("no-existing-file.$$"); |