Asan: correct some undefined, ... problems

This commit is contained in:
Laurent Alonso(fr)
2020-05-16 15:15:38 +02:00
committed by Celtic Minstrel
parent b6c5552ac0
commit 9f802b3fcf
8 changed files with 27 additions and 8 deletions

View File

@@ -387,7 +387,8 @@ static void put_item_graphics(cDialog& me, size_t& first_item_shown, short& curr
if(first_item_shown == 0)
me["up"].hide();
else me["up"].show();
if(first_item_shown > item_array.size() - 7 ||
// ASAN undefined behaviour, ie. item_array.size can be less than 7
if(first_item_shown+7 > item_array.size() ||
item_array.size() <= 8)
me["down"].hide();
else me["down"].show();