[sane-devel] Small xscanimage bug

gerard klaver gerard@gkall.hobby.nl
17 Jul 2003 16:23:05 +0000


On Thu, 2003-07-17 at 05:17, Michael Herder wrote:
> Hi,
> Gerard Klaver reported a small bug in xscanimage (and quiteinsane). I don't 
> know, whether he also informed the xscanimage maintainer, therefore I report 
> it on sane-devel.
Not yet, but thanks :-)
> 
> Problem:
> The size of huge images gets displayed incorrectly. For instance, the size 
> of a  27192 x 37439 image in 8bit RGB mode is reported as 1185,07 Mbyte.
> 
> Fix:
> Cast ints to double before multiplication.
> In xscanimage.c around line 464 change
> double size = params.bytes_per_line * params.lines;
> 
> to
> 
> double size = (double)params.bytes_per_line * (double)params.lines;
> 
> otherwise multiplying two ints might exceed INT_MAX.
> 
> bb
> Michael

I've changed the following lines in the test backend so you don't need a
connected scanner to test this:

test.conf line 27 change 1200 to 4800
test.c    line 88 change 1200 to 4800

-- 
----------
m.vr.gr.
Gerard Klaver