Fix undefined behavior (#6089)

Fix TimeSplit crash on empty name

Initialize OptionValue::mVal to fix undefined behavior

Fix undefined behavior in GraveHoleJumps surface type copy.
The memcpy was reading 33 SurfaceTypes regardless of the actual count,
causing a buffer overread since NTSC 1.0 only has 31 surface types and
later versions have 32. Now uses the actual surfaceTypesCount from the
collision header.

Fix undefined behavior in framebuffer OTR signature check.
Use calloc instead of malloc for framebuffer allocation to zero-initialize
the memory. This fixes Valgrind warnings about reading uninitialized values
when ResourceMgr_OTRSigCheck reads from framebuffer pointers to check for
the "__OTR__" signature.

Fix undefined behavior in fontLoadStatus initialization.
Use calloc instead of malloc when allocating fontLoadStatus array
to ensure zero-initialization. This fixes Valgrind warnings about
conditional jumps depending on uninitialized values in
AudioLoad_SetFontLoadStatus.
This commit is contained in:
Paul Schwabauer
2026-01-10 22:31:21 +01:00
committed by GitHub
parent 7627b0567b
commit cd8bd69c6e
5 changed files with 11 additions and 10 deletions

View File

@@ -36,8 +36,8 @@ void SysCfb_Init(s32 n64dd) {
osSyncPrintf("システムが使用する最終アドレスは %08x です\n", sSysCfbEnd);
// sSysCfbFbPtr[0] = sSysCfbEnd - (screenSize * 4);
// sSysCfbFbPtr[1] = sSysCfbEnd - (screenSize * 2);
sSysCfbFbPtr[0] = malloc(screenSize * 4);
sSysCfbFbPtr[1] = malloc(screenSize * 4);
sSysCfbFbPtr[0] = (uintptr_t)calloc(screenSize, 4);
sSysCfbFbPtr[1] = (uintptr_t)calloc(screenSize, 4);
// "Frame buffer addresses are %08x and %08x"
// osSyncPrintf("フレームバッファのアドレスは %08x と %08x です\n", sSysCfbFbPtr[0], sSysCfbFbPtr[1]);