From b92e73e7367d20377f985312306f1f3028c795e9 Mon Sep 17 00:00:00 2001 From: "Laurent Alonso(fr)" Date: Fri, 8 May 2020 13:29:29 +0200 Subject: [PATCH] ASAN: fix another array bound problem... --- src/game/boe.locutils.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/game/boe.locutils.cpp b/src/game/boe.locutils.cpp index 0e9ea5b5..8f5aba2f 100644 --- a/src/game/boe.locutils.cpp +++ b/src/game/boe.locutils.cpp @@ -273,8 +273,12 @@ void update_explored(location dest) { bool is_blocked(location to_check) { short gr; ter_num_t ter; - + // ASAN: location can be bad if we are called by place_party + if (to_check.x<0 || to_check.y<0) + return true; if(is_out()) { + if (to_check.x>=96 || to_check.y>=96) // checkme: maybe >=48 + return true; if(impassable(univ.out[to_check.x][to_check.y])) { return true; } @@ -288,6 +292,8 @@ bool is_blocked(location to_check) { } if((is_town()) || (is_combat())) { + if (to_check.x >= univ.town->max_dim || to_check.y >= univ.town->max_dim) + return true; ter = univ.town->terrain(to_check.x,to_check.y); gr = univ.scenario.ter_types[ter].picture;