From fee91096ca71a7215a3d6e6b92cacc1227e23fd0 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Sat, 27 May 2023 22:10:54 -0400 Subject: microprofile: Avoid crashing due to OOB stack pos --- externals/microprofile/microprofile.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'externals') diff --git a/externals/microprofile/microprofile.h b/externals/microprofile/microprofile.h index 639f3618c..8f75a25aa 100644 --- a/externals/microprofile/microprofile.h +++ b/externals/microprofile/microprofile.h @@ -1697,7 +1697,13 @@ void MicroProfileFlip() { int nTimer = MicroProfileLogTimerIndex(LE); uint8_t nGroup = pTimerToGroup[nTimer]; - MP_ASSERT(nStackPos < MICROPROFILE_STACK_MAX); + + // To avoid crashing due to OOB memory accesses/asserts + // simply skip this iteration + // MP_ASSERT(nStackPos < MICROPROFILE_STACK_MAX); + if (nStackPos >= MICROPROFILE_STACK_MAX) { + break; + } MP_ASSERT(nGroup < MICROPROFILE_MAX_GROUPS); pGroupStackPos[nGroup]++; pStack[nStackPos++] = k; -- cgit v1.2.3