AurieFramework / YYToolkit

The definitive internal modding tool for GameMaker games
GNU Affero General Public License v3.0
72 stars 10 forks source link

InvokeWithObject crashes in x86 #69

Closed Archie-osu closed 2 months ago

Archie-osu commented 2 months ago

The loop here:

// Loop all active instances in the room
for (
    CInstance* inst = current_room->m_ActiveInstances.m_First; 
    inst != nullptr; 
    inst = inst->GetMembers().m_Flink
)
{
    // Check if the ID matches our target instance
    if (inst->GetMembers().m_ID != InstanceID)
        continue;

    // Return the pointer to it
    Instance = inst;
    return AURIE_SUCCESS;
}

seems to be problematic, as pointers easily get into unmapped memory, which crashes the runner. Initial investigation indicates a problem with struct misalignment. Occurs on a GM 2022.6 game "Islets" (Steam ver., x86). YYObjectBase seems to be aligned correctly (at least m_RValueInitType has it's expected value), so it seems that only CInstance is affected to the point where the ID is improperly read.

Archie-osu commented 2 months ago

Fixed in v3.3.2.