diff --git a/tools/tiff2ps.c b/tools/tiff2ps.c index 5660a68b..a5b943ec 100644 --- a/tools/tiff2ps.c +++ b/tools/tiff2ps.c @@ -2264,7 +2264,7 @@ PS_Lvl2page(FILE* fd, TIFF* tif, uint32 w, uint32 h) if (alpha) { int adjust, i, j = 0; int ncomps = samplesperpixel - extrasamples; - for (i = 0; i < byte_count; i+=samplesperpixel) { + for (i = 0; (i + ncomps) < byte_count; i+=samplesperpixel) { adjust = 255 - buf_data[i + ncomps]; switch (ncomps) { case 1: