Skip to content

Commit

Permalink
GP-4035 updated to not use address.subtract to determine inst offset,
Browse files Browse the repository at this point in the history
which could in some cases cause an overflow error.
  • Loading branch information
ghidra007 committed Nov 13, 2023
1 parent 07f0f57 commit 07c9fb3
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1224,10 +1224,14 @@ private Map<Long, Map<Integer, Object>> mapFunctionScalarAndAddressOperands(
if (map.keySet().isEmpty()) {
continue;
}

// get offset from top of function to use in function to operandMap map
Long offset =
inst.getAddress().subtract(function.getEntryPoint().getOffset()).getOffset();
// can be positive or negative offset (positive means instruction address is after
// the entry address, negative means instruction address is before entry address)
Long entryOffset = function.getEntryPoint().getOffset();
Long instOffset = inst.getAddress().getOffset();
Long offset = instOffset - entryOffset;

offsetToOperandsMap.put(offset, map);
}

Expand Down

0 comments on commit 07c9fb3

Please sign in to comment.