ASAN: fix another array bound problem...

This commit is contained in:
Laurent Alonso(fr)
2020-05-08 13:29:29 +02:00
committed by Celtic Minstrel
parent 2921b23116
commit b92e73e736

View File

@@ -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;