OSDN Git Service

Debugger[gdb]: Fix crash when stepping over QLocale initialization.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Fri, 22 Jul 2011 15:06:18 +0000 (17:06 +0200)
committerhjk <qthjk@ovi.com>
Mon, 1 Aug 2011 11:21:20 +0000 (13:21 +0200)
Check the index before the array is accessed in the call item.

Task-number: QTCREATORBUG-5576
Change-Id: I3f533ef76af42dad97c93087f2d434b58fdedd44
Reviewed-on: http://codereview.qt.nokia.com/2044
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: hjk <qthjk@ovi.com>
share/qtcreator/dumper/qttypes.py

index ec5119b..f66fba4 100644 (file)
@@ -556,8 +556,19 @@ def qdump__QLinkedList(d, item):
                 d.putSubItem(Item(p["t"], item.iname, i))
                 p = p["n"]
 
+qqLocalesCount = None
 
 def qdump__QLocale(d, item):
+    # Check for uninitialized 'index' variable. Retrieve size of QLocale data array
+    # from variable in qlocale.cpp (default: 368/Qt 4.8), 368 being 'System'.
+    global qqLocalesCount
+    if qqLocalesCount is None:
+        try:
+            qqLocalesCount = int(value(qtNamespace() + 'locale_data_size'))
+        except:
+            qqLocalesCount = 368
+    index = int(item.value["p"]["index"])
+    check(index >= 0 and index <= qqLocalesCount)
     d.putStringValue(call(item.value, "name"))
     d.putNumChild(0)
     return