Skip to content

Assertion in bytesToSlotCount fails in Deltarune Chapter 5 #373

Description

@matteofo

System Info

Platform: Arch Linux 7.1.4-arch1-1
Backend: SDL3

Issue description

Butterscotch hangs during the Susie outfit minigame at the start of Deltarune Chapter 5 due to a failed assertion in the bytesToSlotCount function in vm.c:

static int32_t bytesToSlotCount(VMContext* ctx, int32_t nativeBytes, int32_t stackPos) {
    int32_t slots = 0;
    int32_t remaining = nativeBytes;
    while (remaining > 0) {
        slots++;
        require(stackPos >= slots); // 2. if you remove the assertion below, this one fails later on
        uint8_t slotGmlType = ctx->stack.slots[stackPos - slots].gmlStackType;
        remaining -= gmlTypeNativeSize(slotGmlType);
    }
    require(remaining == 0); // Byte count must align exactly to slot boundaries
    // ^^^ 1. this fails
    return slots;
}
Image Image

Here's a log from Butterscotch up to the hang :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions