Page 1 of 1

Divided by zero exception in ProgressMonitor

Posted: 2008-09-11T01:17:49-07:00
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!

Re: Divided by zero exception in ProgressMonitor

Posted: 2008-09-11T06:13:54-07:00
by magick
Thank you for the patch. We have corrected the problem in the ImageMagick subversion trunk.