Skip to content
Snippets Groups Projects
Commit feeebee4 authored by clc5q's avatar clc5q
Browse files

Detect corner cases of fixed-call pushes and jumps.

Former-commit-id: 7f9438be1b6f30b65e944974d3309f927d4fd625
parent fff7ed84
No related branches found
No related tags found
No related merge requests found
...@@ -227,6 +227,7 @@ void STARS_IRDB_Function_t::FindFixedCalls(SMPFunction *CurrFunc) { ...@@ -227,6 +227,7 @@ void STARS_IRDB_Function_t::FindFixedCalls(SMPFunction *CurrFunc) {
for (list<SMPInstr *>::iterator InstIter = CurrFunc->GetFirstInstIter(); InstIter != CurrFunc->GetLastInstIter(); ++InstIter) { for (list<SMPInstr *>::iterator InstIter = CurrFunc->GetFirstInstIter(); InstIter != CurrFunc->GetLastInstIter(); ++InstIter) {
SMPInstr *CurrInst = (*InstIter); SMPInstr *CurrInst = (*InstIter);
STARS_ea_t InstAddr = CurrInst->GetAddr();
if (CurrInst->IsFixedCallPush()) { if (CurrInst->IsFixedCallPush()) {
FixedCallPushSeen = true; FixedCallPushSeen = true;
STARSOpndTypePtr PushedOpnd = CurrInst->GetPushedOpnd(); STARSOpndTypePtr PushedOpnd = CurrInst->GetPushedOpnd();
...@@ -236,12 +237,19 @@ void STARS_IRDB_Function_t::FindFixedCalls(SMPFunction *CurrFunc) { ...@@ -236,12 +237,19 @@ void STARS_IRDB_Function_t::FindFixedCalls(SMPFunction *CurrFunc) {
if (success && (!TargetIDSet.empty())) { if (success && (!TargetIDSet.empty())) {
assert(1 == TargetIDSet.size()); assert(1 == TargetIDSet.size());
FixedCallPushTargetID = TargetIDSet.begin()->GetIDWithinFile(); FixedCallPushTargetID = TargetIDSet.begin()->GetIDWithinFile();
if (!this->IsInstIDInFunc(FixedCallPushTargetID)) { // trying to find push of return address after fixed call // trying to find push of return address after fixed call
// Corner case: Call could be at end of func, so pushed ID could be outside
// the func.
#if 1
cout << "Found fixed call push at " << InstAddr << " to ID " << FixedCallPushTargetID << endl;
#else
if (!this->IsInstIDInFunc(FixedCallPushTargetID)) {
FixedCallPushTargetID = STARS_BADADDR; FixedCallPushTargetID = STARS_BADADDR;
} }
else { else {
cout << "Found fixed call push at ID " << FixedCallPushTargetID << endl; cout << "Found fixed call push at " << InstAddr << " to ID " << FixedCallPushTargetID << endl;
} }
#endif
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment