mirror of
https://github.com/zeldaret/mm.git
synced 2026-09-06 18:50:59 -04:00
A few UB fixes (#1272)
* Fix OoB in ObjDriftie * Fix OoB in EnHorseLinkChild * Fix negative shift in jpegdecode * more oob fixes * AVOID_UB * clean * huh? * change viint.h macros * objdriftice * ub labelling * review * review * fix z_parameter arrays * u32 cast * missing &
This commit is contained in:
@@ -1109,7 +1109,9 @@ void* AudioHeap_AllocPermanent(s32 tableType, s32 id, size_t size) {
|
||||
gAudioCtx.permanentEntries[index].size = size;
|
||||
//! @bug UB: missing return. "addr" is in v0 at this point, but doing an
|
||||
// explicit return uses an additional register.
|
||||
// return addr;
|
||||
#ifdef AVOID_UB
|
||||
return addr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void* AudioHeap_AllocSampleCache(size_t size, s32 sampleBankId, void* sampleAddr, s8 medium, s32 cache) {
|
||||
|
||||
@@ -738,6 +738,7 @@ void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate) {
|
||||
romAddr = table->entries[realId].romAddr;
|
||||
switch (cachePolicy) {
|
||||
case CACHE_LOAD_PERMANENT:
|
||||
//! @bug UB: triggers an UB because this function is missing a return value.
|
||||
ramAddr = AudioHeap_AllocPermanent(tableType, realId, size);
|
||||
if (ramAddr == NULL) {
|
||||
return ramAddr;
|
||||
@@ -1108,6 +1109,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData,
|
||||
|
||||
switch (cachePolicy) {
|
||||
case CACHE_LOAD_PERMANENT:
|
||||
//! @bug UB: triggers an UB because this function is missing a return value.
|
||||
ramAddr = AudioHeap_AllocPermanent(tableType, realId, size);
|
||||
if (ramAddr == NULL) {
|
||||
return ramAddr;
|
||||
|
||||
Reference in New Issue
Block a user