[sane-devel] Small xscanimage bug

Michael Herder crapsite at gmx.net
Thu Jul 17 06:17:43 BST 2003


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.

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




More information about the sane-devel mailing list