Fix bus errors on Linux/ARM due to word alignment issues
authorSimon Hausmann <simon.hausmann@nokia.com>
Fri, 28 Oct 2011 10:06:17 +0000 (12:06 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 1 Nov 2011 08:30:02 +0000 (09:30 +0100)
If the kernel is configured to SIGBUS on unaligned word access, then the code
in qdeclarativecompiler.cpp that accesses the structs that follow
QDeclarativeVMEMetaData in memory may cause the process to get killed. They
contain integers but they're not aligned.

Ensure that the size of the first structure gives integer alignment for the
following structures.

Change-Id: Iad85557aa3be4949f653d389dbaa3666960be404
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>

src/declarative/qml/qdeclarativevmemetaobject_p.h

index 400961b..6076dcf 100644 (file)
@@ -84,6 +84,8 @@ struct QDeclarativeVMEMetaData
     short aliasCount;
     short signalCount;
     short methodCount;
+    short dummyForAlignment; // Add padding to ensure that the following
+                             // AliasData/PropertyData/MethodData is int aligned.
 
     struct AliasData {
         int contextIdx;