mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 13:24:41 +08:00
Merge remote-tracking branch 'origin/GP-5721_emteere_ConstantPropBugFix' into Ghidra_11.4
This commit is contained in:
@@ -1968,11 +1968,6 @@ public class SymbolicPropogator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't check for params on external calls
|
|
||||||
if (callTarget != null && callTarget.isExternalAddress()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find the calling conventions
|
// find the calling conventions
|
||||||
// look up any register parameters
|
// look up any register parameters
|
||||||
// get the value of each, as soon as find no value, stop
|
// get the value of each, as soon as find no value, stop
|
||||||
|
|||||||
@@ -521,8 +521,7 @@ public class VarnodeContext implements ProcessorContext {
|
|||||||
Reference[] refsFrom = program.getReferenceManager().getReferencesFrom(addr);
|
Reference[] refsFrom = program.getReferenceManager().getReferencesFrom(addr);
|
||||||
if (refsFrom.length > 0 && refsFrom[0].isExternalReference()) {
|
if (refsFrom.length > 0 && refsFrom[0].isExternalReference()) {
|
||||||
Address external = refsFrom[0].getToAddress();
|
Address external = refsFrom[0].getToAddress();
|
||||||
return createVarnode(external.getOffset(), external.getAddressSpace().getSpaceID(),
|
return createVarnode(external.getOffset(), external.getAddressSpace().getSpaceID(), 0);
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the memory is Writeable, then maybe don't trust it
|
// If the memory is Writeable, then maybe don't trust it
|
||||||
@@ -769,7 +768,7 @@ public class VarnodeContext implements ProcessorContext {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Varnode split[] = splitToBytes(value);
|
Varnode split[] = splitToBytes(value, out.getSize());
|
||||||
// copy in partial values after
|
// copy in partial values after
|
||||||
for (int nodeOff = 0; nodeOff < len; nodeOff++) {
|
for (int nodeOff = 0; nodeOff < len; nodeOff++) {
|
||||||
if (split == null) {
|
if (split == null) {
|
||||||
@@ -857,22 +856,21 @@ public class VarnodeContext implements ProcessorContext {
|
|||||||
return new Varnode(addr, size);
|
return new Varnode(addr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Varnode[] splitToBytes(Varnode v) {
|
public Varnode[] splitToBytes(Varnode v, int len) {
|
||||||
if (!isConstant(v)) {
|
if (!isConstant(v)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int size = v.getSize();
|
Varnode split[] = new Varnode[len];
|
||||||
Varnode split[] = new Varnode[size];
|
|
||||||
long value = v.getOffset();
|
long value = v.getOffset();
|
||||||
if (isBE) {
|
if (isBE) {
|
||||||
for (int i = 0; i < v.getSize(); i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
long subv = value >> (i * 8);
|
long subv = value >> (i * 8);
|
||||||
split[size - i - 1] = createConstantVarnode(subv, 1);
|
split[len - i - 1] = createConstantVarnode(subv, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (int i = 0; i < v.getSize(); i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
long subv = value >> (i * 8);
|
long subv = value >> (i * 8);
|
||||||
split[i] = createConstantVarnode(subv, 1);
|
split[i] = createConstantVarnode(subv, 1);
|
||||||
}
|
}
|
||||||
@@ -1406,6 +1404,7 @@ public class VarnodeContext implements ProcessorContext {
|
|||||||
if (!in.isRegister() || !out.isRegister()) {
|
if (!in.isRegister() || !out.isRegister()) {
|
||||||
// normal case easy get value, put value
|
// normal case easy get value, put value
|
||||||
putValue(out, val1, mustClearAll);
|
putValue(out, val1, mustClearAll);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (mustClearAll) {
|
if (mustClearAll) {
|
||||||
clearVals.add(out);
|
clearVals.add(out);
|
||||||
@@ -1666,7 +1665,9 @@ public class VarnodeContext implements ProcessorContext {
|
|||||||
if (isBadAddress(val1)) {
|
if (isBadAddress(val1)) {
|
||||||
return val1;
|
return val1;
|
||||||
}
|
}
|
||||||
return createVarnode(0, addrFactory.getConstantSpace().getSpaceID(), val1.getSize());
|
int size = val1.getSize();
|
||||||
|
size = size > 0 ? size : 1; // turning into constant, make sure has a size
|
||||||
|
return createVarnode(0, addrFactory.getConstantSpace().getSpaceID(), size);
|
||||||
}
|
}
|
||||||
int spaceID = val1.getSpace();
|
int spaceID = val1.getSpace();
|
||||||
long valbase = 0;
|
long valbase = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user