From ba88d332fb9c28689d615f11d934aa6125334082 Mon Sep 17 00:00:00 2001 From: Lunkhound Date: Mon, 29 May 2017 23:54:15 -0700 Subject: [PATCH] fix crash with out of range thread index --- examples/Utils/ChromeTraceUtil.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/Utils/ChromeTraceUtil.cpp b/examples/Utils/ChromeTraceUtil.cpp index 80139719f..02a892ba5 100644 --- a/examples/Utils/ChromeTraceUtil.cpp +++ b/examples/Utils/ChromeTraceUtil.cpp @@ -184,7 +184,7 @@ void MyEnterProfileZoneFunc(const char* msg) return; #ifndef BT_NO_PROFILE int threadId = btQuickprofGetCurrentThreadIndex2(); - if (threadId<0) + if (threadId<0 || threadId >= BT_QUICKPROF_MAX_THREAD_COUNT) return; if (gStackDepths[threadId] >= MAX_NESTING) @@ -208,8 +208,8 @@ void MyLeaveProfileZoneFunc() return; #ifndef BT_NO_PROFILE int threadId = btQuickprofGetCurrentThreadIndex2(); - if (threadId<0) - return; + if (threadId<0 || threadId >= BT_QUICKPROF_MAX_THREAD_COUNT) + return; if (gStackDepths[threadId] <= 0) {