shithub: sce

Download patch

ref: 4819125f8871bab19a4058f14b56bd933d78a357
parent: 8997f5574693ebc97c67c47f7c3e539d6af0ba99
author: qwx <[email protected]>
date: Wed Mar 11 12:54:53 EDT 2020

ai: bound check setblk to avoid out of bounds with path map

--- a/ai.c
+++ b/ai.c
@@ -46,6 +46,10 @@
 	x = mo->o->w * (Tlwidth / Tlsubwidth);
 	y = mo->o->h * (Tlheight / Tlsubheight);
 	lo = mo->blk;
+	if(mo->x + x > pathwidth)
+		x = pathwidth - mo->x;
+	if(mo->y + y > pathheight)
+		y = pathheight - mo->y;
 	while(y-- > 0){
 		for(e=pp+x; pp<e; pp++)
 			if(clr){