GP-4035 updated to not use address.subtract to determine inst offset,

which could in some cases cause an overflow error.
This commit is contained in:
ghidra007 2023-11-13 17:18:43 +00:00
parent 07f0f57cab
commit 07c9fb3f45

View file

@ -1224,10 +1224,14 @@ public class AutoVersionTrackingTask extends Task {
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);
}