Fix byte and char Get32
8 bit and 16 bit fields aren't necessarily 32 bit aligned due to
field packing. This was causing SIGBUS for hprof dumping some apps.
Bug: 19627999
(cherry picked from commit 2ff8da6a4d44bcf6a72dca1b5294a72297c5ce26)
Change-Id: If549412fc4d62c55bb6a46f11658fc60b822a27e
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index d2e93bc..7da22b1 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -1010,10 +1010,10 @@
__ AddU1(t);
switch (size) {
case 1:
- __ AddU1(static_cast<uint8_t>(f->Get32(klass)));
+ __ AddU1(f->GetByte(klass));
break;
case 2:
- __ AddU2(static_cast<uint16_t>(f->Get32(klass)));
+ __ AddU2(f->GetChar(klass));
break;
case 4:
__ AddU4(f->Get32(klass));
@@ -1101,9 +1101,9 @@
size_t size;
SignatureToBasicTypeAndSize(f->GetTypeDescriptor(), &size);
if (size == 1) {
- __ AddU1(f->Get32(obj));
+ __ AddU1(f->GetByte(obj));
} else if (size == 2) {
- __ AddU2(f->Get32(obj));
+ __ AddU2(f->GetChar(obj));
} else if (size == 4) {
__ AddU4(f->Get32(obj));
} else {