In a healer's shop, clicking a dead character's name causes segfault
NQNStudios opened this issue · comments
(on linux)
Actually, this might be more complicated. Clicking anywhere on the screen other than "Done" is causing a segfault. And sometimes, the "Done" button is too (but that might be a hitbox thing).
It only happens when the initially active character doesn't need healing.
I might've spotted a commit in #285 that's related to this…
I just did some tests with my last version of cboe ( monster_code branch ), I could not reproduce this problem ( and asan did not detect anything ) with two dead characters and when no character need healing.
I don't remember seeing this problem, but I guess it was probably fixed by side effect when I fixed all the problems asan was finding :-~
Note or this may be related to fosnola@52ebc70
I recompiled cboe/master, asan reports a first error in handle_shop_event[boe.dlgutil.cpp] that is corrected in fosnola@72e1268
Okay, I fixed that buffer overrun. Is the crash fixed now, or is it more likely to be fixed by 52ebc70?
I was thinking more of the second patch of fosnola@52ebc70
@@ -219,6 +219,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)
But then, asan stops by default at the first problem found, there may be others after...
I don't see that code in the linked commit?
Oops, I meant fosnola@72e1268 (i.e. when I copy and paste the link, I choose the wrong one).
Ah, I got it. That does look like it could be related. (But there was also something in the other commit that looked possibly relevant.)
This is fixed on master.