asan: add a bound check in handle_shop_event

This commit is contained in:
Laurent Alonso(fr)
2020-05-09 11:24:33 +02:00
committed by Celtic Minstrel
parent 8dcf0d0d52
commit c144e83463

View File

@@ -218,6 +218,9 @@ void handle_shop_event(location p) {
}
for(short i = 0; i < 8; i++) {
// asan:
if (i + shop_sbar->getPosition()>=shop_array.size())
break;
unsigned long what_picked = shop_array[i + shop_sbar->getPosition()];
if(what_picked >= active_shop.size()) break;
if(active_shop.getItem(what_picked).type == eShopItemType::EMPTY)