Package: rmagic
Version: 2.21-4
Severity: normal
Tags: patch

Hi,

rmagic fails with the current libgd. I don't have the exact error
message here anymore, but it was something like:

* libgd: a memory allocation (silently) failed because there was a
  multiplicator 0
* in the perl module: new GD::Image(0,0) failed
* using the *not* created object's can() method causes an crash

A patch is attached. Instead of a 0x0 image create a 1x1 image to get
the supported image formats etc.


Andreas


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable'), (300, 'unstable'), (130, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-2-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
# modern libgd produces an error when allocating zero bytes (when creating a 
0x0 image),
# causing the object not to exist and rmagic to fail afterwards
Index: rmagic-2.21/wadg/rm/Settings.pm
===================================================================
--- rmagic-2.21.orig/wadg/rm/Settings.pm        2007-10-06 12:54:34.000000000 
+0200
+++ rmagic-2.21/wadg/rm/Settings.pm     2007-10-06 12:56:08.000000000 +0200
@@ -907,7 +907,7 @@
        # Check GD for support of desired output format. If none
        # given or not capable, then set output format accordingly.
        #
-       my $g = new GD::Image(0,0);
+       my $g = new GD::Image(1,1);
 
        if( defined $self->val( 'graphs', 'Format' ) ) {
                if( $self->val( 'graphs', 'Format' ) =~ /jpe?g/i ) {

Reply via email to