ARM64: Fix array out of bounds access in DoLongJump
Only copy the "real" 32 registers, not the virtual 33rd XZR.
Change-Id: I911a56e3ae3a4e76fd29da5eb7caae5c000fdc28
diff --git a/runtime/arch/arm64/context_arm64.cc b/runtime/arch/arm64/context_arm64.cc
index 3d63c36..c96ff60 100644
--- a/runtime/arch/arm64/context_arm64.cc
+++ b/runtime/arch/arm64/context_arm64.cc
@@ -116,7 +116,8 @@
uint64_t gprs[32];
uint64_t fprs[32];
- for (size_t i = 0; i < kNumberOfCoreRegisters; ++i) {
+ // Do not use kNumberOfCoreRegisters, as this is with the distinction of SP and XZR
+ for (size_t i = 0; i < 32; ++i) {
gprs[i] = gprs_[i] != NULL ? *gprs_[i] : Arm64Context::kBadGprBase + i;
}
for (size_t i = 0; i < kNumberOfDRegisters; ++i) {