Divided by zero exception in ProgressMonitor

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
mootools
Posts: 19
Joined: 2005-06-30T06:08:40-07:00
Location: France

Divided by zero exception in ProgressMonitor

Post by mootools »

Hello,

I use ImageMagick 6.4.2-6 and I wometime get a divided by zero exception due to the monitor handler.
It occurs in the QuantumTick inline method (monitor.h) when span = 100.

I correct the code below:

static inline MagickBooleanType QuantumTick(const MagickOffsetType offset,
const MagickSizeType span)
{
if (span <= 100) // Instead span < 100
return(MagickTrue);
if ((offset % ((span-1)/100)) == 0) // Exception if span=100 => ((offset % (99/100)) and 99/100 is egal to zero
return(MagickTrue);
if (offset == (MagickOffsetType) (span-1))
return(MagickTrue);
return(MagickFalse);
}

Thanks you!
Manuel Jouglet
Mootools
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Divided by zero exception in ProgressMonitor

Post by magick »

Thank you for the patch. We have corrected the problem in the ImageMagick subversion trunk.
Post Reply