summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-01 01:03:54 +0000
committerfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-01 01:03:54 +0000
commitd20057a048c37ffff0b5a09a2d07acd25cb69eaf (patch)
treed2eec0de97b0749a8f25f72406436e3124b2e974 /third_party
parentd04217b61859bf787ccba9ad7511eab42d229570 (diff)
downloadchromium_src-d20057a048c37ffff0b5a09a2d07acd25cb69eaf.zip
chromium_src-d20057a048c37ffff0b5a09a2d07acd25cb69eaf.tar.gz
chromium_src-d20057a048c37ffff0b5a09a2d07acd25cb69eaf.tar.bz2
jsoncpp: force alignment of Json::Value::null to avoid crashes on ARM.
BUG=109997,https://code.google.com/p/webrtc/issues/detail?id=1777 Review URL: https://codereview.chromium.org/24984004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/jsoncpp/overrides/src/lib_json/json_value.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/third_party/jsoncpp/overrides/src/lib_json/json_value.cpp b/third_party/jsoncpp/overrides/src/lib_json/json_value.cpp
index 850724f..a2a4a67 100644
--- a/third_party/jsoncpp/overrides/src/lib_json/json_value.cpp
+++ b/third_party/jsoncpp/overrides/src/lib_json/json_value.cpp
@@ -27,8 +27,14 @@
namespace Json {
// This is a walkaround to avoid the static initialization of Value::null.
-// const Value Value::null;
-static const unsigned char kNull[sizeof(Value)] = { 0 };
+// kNull must be word-aligned to avoid crashing on ARM. We use an alignment of
+// 8 (instead of 4) as a bit of future-proofing.
+#if defined(__ARMEL__)
+#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
+#else
+#define ALIGNAS(byte_alignment)
+#endif
+static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = {0};
const Value& Value::null = reinterpret_cast<const Value&>(kNull);
const Int Value::minInt = Int( ~(UInt(-1)/2) );