From b8956d0111c1ab18d6da1ef5083005e2de9689f4 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 21 Aug 2015 16:43:15 +0300 Subject: [PATCH] tls: fix access to array (out of bounds) --- modules/core/src/system.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index 7631a3dba4..bf1a71a8f4 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -1089,9 +1089,10 @@ public: for(size_t i = 0; i < threads.size(); i++) { - if(threads[i]->slots[slotIdx]) + std::vector& thread_slots = threads[i]->slots; + if (thread_slots.size() > slotIdx && thread_slots[slotIdx]) { - dataVec.push_back(threads[i]->slots[slotIdx]); + dataVec.push_back(thread_slots[slotIdx]); threads[i]->slots[slotIdx] = 0; } }