rmagic fails on call to GD

Bug #315280 reported by Mark Ellison
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
rmagic (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: rmagic

Using Ubuntu 8.10,

Although the error message comes from libgd, it's due to the code in the Settings.pm file referred to below. The problem is that this perl script tries to create a 0x0 image, which apparently worked with earlier versions of libgd.

I expected rmagic (called from a complex PERL script) to generate a report from the output of analog. Instead, no report, and the error message:

gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
Can't call method "can" on an undefined value at /usr/share/rmagic/wadg/rm/Settings.pm line 928.

Here is a fix that worked for me, Settings-orig.pm is the version of Settings.pm which came with the package.

--- Settings-orig.pm 2009-01-09 08:42:44.000000000 +0900
+++ Settings.pm 2009-01-09 08:43:07.000000000 +0900
@@ -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 ) {

Revision history for this message
Andrew Fabian (afabian) wrote :

I just tried Mark's suggested fix. Worked perfectly for me.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Confirmed on Hardy (rmagic 2.21-4). This would make a fine SRU candidate, since rmagic seems virtually unusable atm.

Changed in rmagic:
status: New → Confirmed
Revision history for this message
berni123 (bernd-bernd--zimmermann) wrote :

Confirmed on Hardy too.
Fixed this way and rmagic is working now.

Revision history for this message
Kevin (kkd) wrote :

confirmed on Lucid, patch works.

Revision history for this message
Ingram (ingram87) wrote :

Could anyone explain how to apply the patch?

Revision history for this message
Ingram (ingram87) wrote :

Just open Settings.pm and search for this line:

my $g = new GD::Image(0,0);

Change it to:

my $g = new GD::Image(1,1);

(Thanks to Kevin)

Changed in rmagic (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package rmagic - 2.21-4ubuntu1

---------------
rmagic (2.21-4ubuntu1) oneiric; urgency=low

  * 9000-lp315280.patch: create a 1x1 image instead of dying on a 0x0 image
    with recent versions of gd. (LP: #315280)
 -- Jamie Strandboge <email address hidden> Tue, 20 Sep 2011 08:13:10 -0500

Changed in rmagic (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.