From: Ian Jackson Date: Wed, 24 Jun 2009 23:28:29 +0000 (+0100) Subject: do not read out of range bits of the image X-Git-Tag: 1.9.2~90^2~31 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=commitdiff_plain;h=6d7c97eb148bbc805f506a5d7453daafa6a18898;hp=e1678818393f23b138a4ef8c7c247de8cb97d741 do not read out of range bits of the image --- diff --git a/pctb/rgbimage.c b/pctb/rgbimage.c index d0ba6b7..c4fd11d 100644 --- a/pctb/rgbimage.c +++ b/pctb/rgbimage.c @@ -89,7 +89,9 @@ static int identify1(const RgbImage *base, Rect portion, int c; dbassert( dbfile_scanf("%d",&c) == 1); dbassert(c>=0 && c<=255); - diff |= (c != RI_PIXEL(base, portion.tl.x + x, portion.tl.y + y)[i]); + int px= portion.tl.x + x, py= portion.tl.y + y; + diff |= px > portion.br.x || py > portion.br.y || + (c != RI_PIXEL(base,px,py)[i]); } } }