tls: fix access to array (out of bounds)
authorAlexander Alekhin <alexander.alekhin@itseez.com>
Fri, 21 Aug 2015 13:43:15 +0000 (16:43 +0300)
committerAlexander Alekhin <alexander.alekhin@itseez.com>
Fri, 21 Aug 2015 13:43:15 +0000 (16:43 +0300)
modules/core/src/system.cpp

index 7631a3d..bf1a71a 100644 (file)
@@ -1089,9 +1089,10 @@ public:
 
         for(size_t i = 0; i < threads.size(); i++)
         {
-            if(threads[i]->slots[slotIdx])
+            std::vector<void*>& 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;
             }
         }