[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kjs
From:       Maks Orlovich <maksim () kde ! org>
Date:       2009-02-07 18:59:30
Message-ID: 1234033170.161365.13464.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 922903 by orlovich:

Merged revision 922902:
Fix crash when we create a sparse array w/o a dense vector component, and then access [0].
BUG:180605

 M  +7 -0      array_instance.cpp  


--- trunk/KDE/kdelibs/kjs/array_instance.cpp #922902:922903
@@ -254,6 +254,13 @@
         if (!map) {
             map = new SparseArrayValueMap;
             storage->m_sparseValueMap = map;
+
+            // If we create a sparse map, we need to ensure that there is at least one spot
+            // in the vector map, however, since the sparse map can't put/get key 0.
+            // It's safe to do it here, since put(0) will always put it in the vector part,
+            // but we have to do it before a get(0) or it will crash
+            if (!m_vectorLength)
+                increaseVectorLength(1);
         }
         map->add(i, value);
         return;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic