Skip to content

Fix UBSan issues#6460

Open
koplas wants to merge 9 commits intoHarbourMasters:developfrom
koplas:ubsan
Open

Fix UBSan issues#6460
koplas wants to merge 9 commits intoHarbourMasters:developfrom
koplas:ubsan

Conversation

@koplas
Copy link
Copy Markdown
Contributor

@koplas koplas commented Apr 4, 2026

Fixes various UBSan issues encountered when running the title screen. Also tested with an 4k texture pack.

Build Artifacts

@koplas
Copy link
Copy Markdown
Contributor Author

koplas commented Apr 4, 2026

clang-format seems to introduce some unexpected format changes. Should I revert them by hand, or do they not disturb?

Comment thread soh/include/macros.h Outdated
Comment thread soh/include/macros.h Outdated
Comment thread soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c Outdated
0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
};

s32 Overlay_Load(uintptr_t vRomStart, uintptr_t vRomEnd, void* vRamStart, void* vRamEnd, void* allocatedVRamAddr) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function moved to https://github.com/zeldaret/oot/blob/b50e208d60c3c86e634909af6e3b204a9e9a5272/src/libu64/load_gc.c on its own, not sure where all this stuffi s upstream now, with #if 0 here it'd be silly to keep code that isn't even in sync with upstream. matter of another PR tho

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted the commit for now. I will check if I can address this in another pull request.

Comment thread soh/include/z64player.h
}
if (this->actor.shape.rot.y == 0) {
this->actor.shape.rot.y = this->actor.world.rot.y = Rand_ZeroFloat(0x10000);
this->actor.shape.rot.y = this->actor.world.rot.y = (s16)(u16)(s32)Rand_ZeroFloat(0x10000);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we like to stay in agreement with upstream https://github.com/zeldaret/oot

unless these fixes are addressing real problems (OOB reads) either get these accepted upstream or exclude soh/src from ubsan

@serprex
Copy link
Copy Markdown
Member

serprex commented Apr 4, 2026

thanks for this, I'm not sure how much we can tune ubsan to ignore certain sections of code, but at least for our code in soh/soh/Enhancements this is very good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants