PerlMagick: Failing to load Magick.so in eval block brings down machine

Michael Kröll <[email protected]>
Newsgroups gmane.comp.video.image-magick.bugs
Message-ID <[email protected]>
Hi,

Problem Description:
In situations there the image magick shared libraries are not found any
longer, e.g. because of an outdated ls.so.cache, Image::Magick::AUTOLOAD
causes an endless loop eating up all memory and CPU if Image::Magick is
require'd at runtime via an string eval block. Endless loop will be
triggered at exit of the program at latest when the END block calls the
XS UNLOAD() function which is in this case not defined.

Systems Affected:
At least Solaris and Linux with current stable kernels

Fix:
Check if Image::Magick::constant is defined in AUTOLOAD() function.
Patch against 6.4.4 attached.

Regards,
Michael Kröll

-- 
063A F25E B064 A98F A479  1690 78CD D023 5E2A 6688
http://zis.uibk.ac.at/.m/uibk.ac.at_pgp_pubkey.asc

_______________________________________________
Magick-bugs mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-bugs
Magick.pm.in-noendlessloop.patch (text/plain, 430 B)
--- Magick.pm.in-6.4.4	2008-10-15 17:02:48.220945000 +0200
+++ Magick.pm.in	2008-10-15 17:03:23.847648000 +0200
@@ -39,6 +39,7 @@
 
     my $constname;
     ($constname = $AUTOLOAD) =~ s/.*:://;
+    die "&${AUTOLOAD} not defined. It is likely that your ImageMagick library files could not be found!\n" if $constname eq 'constant';
     my $val = constant($constname, @_ ? $_[0] : 0);
     if ($! != 0) {
 	if ($! =~ /Invalid/) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.