Avoid some potential UB in bgBuildTables

This commit is contained in:
Ryan Dwyer 2022-10-31 17:30:51 +10:00
parent 39c00dc465
commit e3d77e8086
1 changed files with 4 additions and 1 deletions

View File

@ -3251,7 +3251,10 @@ void bgBuildTables(s32 stagenum)
inflatedsize = (inflatedsize | 0xf) + 1;
// Load and inflate section 3
#if VERSION >= VERSION_NTSC_FINAL
#ifdef AVOID_UB
section3 = mempAlloc(inflatedsize + section3compsize, MEMPOOL_STAGE);
scratch = section3 + inflatedsize;
#elif VERSION >= VERSION_NTSC_FINAL
section3 = mempAlloc(inflatedsize + 0x8000, MEMPOOL_STAGE);
scratch = section3 + 0x8000;
#else