Skip to content

Possible UB in pokemon_storage_system.c #2106

@luckytyphlosion

Description

@luckytyphlosion

https://github.com/pret/pokeemerald/blob/9bf7a77/src/pokemon_storage_system.c#L560
static u32 sItemIconGfxBuffer[98]; think this definition causes UB, the sprite sheet size is 0x200 but this only allocates 0x188 bytes

https://github.com/pret/pokeemerald/blob/9bf7a77/src/pokemon_storage_system.c#L8735-L8737

        spriteSheet.data = sItemIconGfxBuffer;
        spriteSheet.size = 0x200;
        spriteTemplate = sSpriteTemplate_ItemIcon;

Noticed this when I tried to move this buffer to alloc'd space

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