diff options
| author | Max Roncace <me@caseif.net> | 2026-03-18 01:38:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-17 22:38:05 -0700 |
| commit | 6694c1b281a142972fce587bd20cd82ee65ab38f (patch) | |
| tree | 2537d09d5ab3d270eaca5143a4f2f2f65f4ecb49 /src/d/d_msg_object.cpp | |
| parent | 9f340b604b5ac3d19d330b7bd6a2d7355c58bc27 (diff) | |
Fix a bunch of compiler warnings and document several more bugs (#3130)
Diffstat (limited to 'src/d/d_msg_object.cpp')
| -rw-r--r-- | src/d/d_msg_object.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/d/d_msg_object.cpp b/src/d/d_msg_object.cpp index 0cb515113c..29b8cbdd41 100644 --- a/src/d/d_msg_object.cpp +++ b/src/d/d_msg_object.cpp @@ -1602,7 +1602,16 @@ u8 dMsgObject_c::isSend() { } void dMsgObject_c::readMessageGroupLocal(mDoDvdThd_mountXArchive_c** p_arcMount) { +#if AVOID_UB + // largest possible value msgGroup appears to be 99, but just in case + // we leave enough space to fit INT_MAX + static char arcName[32]; +#else + // We write at least 23 bytes into this which causes an overflow, + // but in practice arcName is followed by two bytes of padding + // at the end of .bss which mitigates the problem. static char arcName[22]; +#endif int msgGroup = dStage_stagInfo_GetMsgGroup(dComIfGp_getStage()->getStagInfo()); #if REGION_PAL @@ -2133,7 +2142,7 @@ u16 dMsgObject_c::getSmellTypeMessageIDLocal() { if (smell < dItemNo_SMELL_MEDICINE_e + 1 && smell >= dItemNo_SMELL_YELIA_POUCH_e) { msgId = smell + 0x165; } else { - if (dComIfGs_getCollectSmell() != -1) { + if (dComIfGs_getCollectSmell() != 0xFF) { OS_REPORT("smell type ====> %d\n", dComIfGs_getCollectSmell()); JUT_WARN(4858, "smell type no entry!"); } |
