Mercurial > hg > batmud > maputils
changeset 1883:cb13335d85cf
Add sanity check for size against the cropped block.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 04 Nov 2017 20:43:20 +0200 |
parents | 6294c4ae82b2 |
children | 32033f5c65e9 |
files | mapsearch.c |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mapsearch.c Sat Nov 04 20:36:13 2017 +0200 +++ b/mapsearch.c Sat Nov 04 20:43:20 2017 +0200 @@ -906,7 +906,7 @@ mapMSG(2, "Parsed block size %d x %d\n", width, height); - // Do few basic checks for sanity + // Do basic checks for sanity if (width * height < 3) { *verr = "Search block pattern too small."; @@ -936,6 +936,13 @@ pattern->width, pattern->height); } + // Sanity checks against the cropped block + if (pattern->width * pattern->height < 3) + { + *verr = "Search block pattern too small."; + goto out; + } + // Print the cropped block if (th_verbosityLevel >= 2) {