From 2e730e89e6ee4b6605ecc21293be98f1421f7a61 Mon Sep 17 00:00:00 2001
From: Clark Coleman <clc@zephyr-software.com>
Date: Mon, 11 Feb 2019 16:34:31 -0500
Subject: [PATCH] Fix assertion problem on indexed stack accesses with baser
 offset outside stack frame.

---
 src/base/SMPFunction.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/base/SMPFunction.cpp b/src/base/SMPFunction.cpp
index 2c519e2e..0dcb1bb4 100644
--- a/src/base/SMPFunction.cpp
+++ b/src/base/SMPFunction.cpp
@@ -3524,6 +3524,9 @@ void SMPFunction::BuildStackAccessTables(void) {
 
 					bool ESPRelative = (!(UsedFramePointer || CurrInst->HasFPNormalizedToSP()));
 					if (SignedOffset < 0) {
+						if (IndexedAccess && ((offset + DataSize - 1) >= this->NegativeOffsetStackFrameMap.size())) {
+							continue; // Indexed expressions can be within frame even when offset is outside frame
+						}
 						assert((offset + DataSize - 1) < this->NegativeOffsetStackFrameMap.size());
 						for (int j = 0; j < (int) DataSize; ++j) { // offset has zero-based index into negative offset vectors
 							this->NegativeOffsetStackFrameMap[offset + j].Written = true;
-- 
GitLab