From: Tony Cook Date: Mon, 31 Dec 2018 11:02:27 +0000 (+1100) Subject: addi style makemap could potentially read one past the end of an array X-Git-Tag: v1.009~38 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/f7675b46b77133b516c407fdd9f63abcca50fd45 addi style makemap could potentially read one past the end of an array --- diff --git a/Changes b/Changes index 0847cf88..82644d70 100644 --- a/Changes +++ b/Changes @@ -18,6 +18,9 @@ Coverity finally finished a build, fix a few problems: - initialize a pointer to prevent Coverity complaining in polygon drawing (it should always end up being set.) + - addi style makemap could potentially read one past the end of an + array. + Imager 1.008 - 31 Dec 2018 ============ diff --git a/quant.c b/quant.c index e831abf3..9d6e947d 100644 --- a/quant.c +++ b/quant.c @@ -1514,7 +1514,7 @@ static void reorder(pbox prescan[512]) { c.cand++; c.pdc=c.pixcnt/(c.cand*c.cand); /* c.pdc=c.pixcnt/c.cand; */ - while(c.pdc < prescan[nidx+1].pdc && nidx < 511) { + while(nidx < 511 && c.pdc < prescan[nidx+1].pdc) { prescan[nidx]=prescan[nidx+1]; nidx++; }