b-casey / OpenSMACX

A project to decompile SMAC/X to C++ with the long term goal of creating a full open source clone.
GNU General Public License v3.0
52 stars 4 forks source link

Crash or weird behavior when using 'Edit Map' to reset fungus #35

Open b-casey opened 3 years ago

b-casey commented 3 years ago

Edit Map > Generate/Remove Fungus > No Fungus

This will either cause a crash when attempting to calculate current council votes for UI or run through a turn immediately and prompt for PBEM password even in a single player game. The crash is caused by a buffer overflow in council_votes() when InfoWin::setup_text passes 8 as non-existent faction id.

The problem stems from how an iterator sets Console.faction_id_current_human to 8 inside the following function: 004E13E0 ; void __thiscall Console::editor_fungus(Console *__hidden this)