From f211d416cc2dc41a57a31c6f9aa735ee74b8e7ac Mon Sep 17 00:00:00 2001
From: Matthew McGill <mhollismcgill@gmail.com>
Date: Sun, 13 Jan 2019 18:19:56 +0000
Subject: [PATCH] Fixed de_end_loc not being set correctly when plugin places
 entry but not instruction.

---
 src/zipr.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/zipr.cpp b/src/zipr.cpp
index 3968a7b9b..f4ec4d2ea 100644
--- a/src/zipr.cpp
+++ b/src/zipr.cpp
@@ -1787,7 +1787,15 @@ RangeAddress_t ZiprImpl_t::_PlopDollopEntry(DollopEntry_t *entry, RangeAddress_t
 	 */
 	if (!placed_insn)
 	{
-		updated_addr = PlopDollopEntry(entry, placed_address, target_address);
+		/* Some plugins, like scfi, may place the entry but leave it 
+		   up to zipr to place the instruction. This does assume that 
+		   zipr will place the instruction in a way that is compatible 
+		   with what the plugin is trying to do.
+		   
+		   TODO: Should we continue to allow this?
+		*/
+		const auto zipr_ret = PlopDollopEntry(entry, placed_address, target_address); 
+		updated_addr = std::max(zipr_ret, updated_addr);
 	}
 
 	// sanity check that we aren't moving an instruction that's already been placed.	
-- 
GitLab