diff options
| author | Paul Schwabauer <github@schwabauer.co> | 2026-01-10 22:31:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-10 21:31:21 +0000 |
| commit | cd8bd69c6e65c185e757133bcf67ff82ce7cf748 (patch) | |
| tree | 17cd8228277e3adf04298653d3686fa97e518499 /soh/src/code/sys_cfb.c | |
| parent | 7627b0567b9d216896ef909a4db10cf78149c160 (diff) | |
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.
Diffstat (limited to 'soh/src/code/sys_cfb.c')
| -rw-r--r-- | soh/src/code/sys_cfb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/soh/src/code/sys_cfb.c b/soh/src/code/sys_cfb.c index 53e9306bc..8bfb3f669 100644 --- a/soh/src/code/sys_cfb.c +++ b/soh/src/code/sys_cfb.c @@ -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]); |
