From 6b8dc7684aff8b0d5ad2b91c986be4bee092f126 Mon Sep 17 00:00:00 2001 From: leper Date: Sun, 15 Nov 2015 01:09:35 +0000 Subject: [PATCH] Return in case we do not have any available JS timer slots instead of accessing OOB memory. This was SVN commit r17263. --- source/gui/scripting/ScriptFunctions.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/gui/scripting/ScriptFunctions.cpp b/source/gui/scripting/ScriptFunctions.cpp index 56eae41376..956bf31a30 100644 --- a/source/gui/scripting/ScriptFunctions.cpp +++ b/source/gui/scripting/ScriptFunctions.cpp @@ -904,7 +904,10 @@ void StartJsTimer(ScriptInterface::CxPrivate* pCxPrivate, unsigned int slot) ONCE(InitJsTimers(*(pCxPrivate->pScriptInterface))); if (slot >= MAX_JS_TIMERS) + { LOGERROR("Exceeded the maximum number of timer slots for scripts!"); + return; + } js_start_times[slot].SetFromTimer(); } @@ -912,7 +915,10 @@ void StartJsTimer(ScriptInterface::CxPrivate* pCxPrivate, unsigned int slot) void StopJsTimer(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), unsigned int slot) { if (slot >= MAX_JS_TIMERS) + { LOGERROR("Exceeded the maximum number of timer slots for scripts!"); + return; + } TimerUnit now; now.SetFromTimer();