Skip to content

nullptr access in AddDevice (A64, arm, PPC) due to half empty devoptab table #35

@ITotalJustice

Description

@ITotalJustice

Bug Report

The STD_MAX is set to 35, however only 15 entries are filled https://github.com/devkitPro/buildscripts/blob/b5cdec82b7a5e9bcac1b887ad9108855fc81c349/dka64/patches/newlib-4.5.0.20241231.patch#L8028, so once you try to add device 16, it will crash.

This bug exists in all versions. PPC https://github.com/devkitPro/buildscripts/blob/b5cdec82b7a5e9bcac1b887ad9108855fc81c349/dkppc/patches/newlib-4.5.0.20241231.patch#L7978 and arm https://github.com/devkitPro/buildscripts/blob/b5cdec82b7a5e9bcac1b887ad9108855fc81c349/dkarm-eabi/patches/newlib-4.5.0.20241231.patch#L8028.

imo, i would remove the STD_MAX from the array and have the array size be calculated automatically, then add a static_assert(STD_MAX == sizeof(devoptab_list) / sizeof(devoptab_list[0]), "devoptab_list size missmatch!") in case the size is ever changed again.

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