Performing ActionSetCasts much later

This commit is contained in:
caheckman 2019-11-01 10:12:31 -04:00
parent 5fbbef38ac
commit cbbfc9ca18
2 changed files with 16 additions and 3 deletions

View file

@ -4651,12 +4651,12 @@ void universal_action(Architecture *conf)
act->addAction( new ActionHideShadow("merge") ); act->addAction( new ActionHideShadow("merge") );
act->addAction( new ActionCopyMarker("merge") ); act->addAction( new ActionCopyMarker("merge") );
act->addAction( new ActionOutputPrototype("localrecovery") ); act->addAction( new ActionOutputPrototype("localrecovery") );
act->addAction( new ActionSetCasts("casts") );
act->addAction( new ActionInputPrototype("fixateproto") ); act->addAction( new ActionInputPrototype("fixateproto") );
act->addAction( new ActionRestructureHigh("localrecovery") ); act->addAction( new ActionRestructureHigh("localrecovery") );
act->addAction( new ActionMapGlobals("fixateglobals") ); act->addAction( new ActionMapGlobals("fixateglobals") );
act->addAction( new ActionDynamicSymbols("dynamic") ); act->addAction( new ActionDynamicSymbols("dynamic") );
act->addAction( new ActionNameVars("merge") ); act->addAction( new ActionNameVars("merge") );
act->addAction( new ActionSetCasts("casts") );
act->addAction( new ActionFinalStructure("blockrecovery") ); act->addAction( new ActionFinalStructure("blockrecovery") );
act->addAction( new ActionPrototypeWarnings("protorecovery") ); act->addAction( new ActionPrototypeWarnings("protorecovery") );
act->addAction( new ActionStop("base") ); act->addAction( new ActionStop("base") );

View file

@ -666,8 +666,21 @@ void AliasChecker::gatherAdditiveBase(Varnode *startvn,vector<AddBase> &addbase)
vnqueue.push_back(AddBase(subvn,indexvn)); vnqueue.push_back(AddBase(subvn,indexvn));
} }
break; break;
case CPUI_INT_ADD:
case CPUI_INT_SUB: case CPUI_INT_SUB:
if (vn == op->getIn(1)) { // Subtracting the pointer
nonadduse = true;
break;
}
othervn = op->getIn(1);
if (!othervn->isConstant())
indexvn = othervn;
subvn = op->getOut();
if (!subvn->isMark()) {
subvn->setMark();
vnqueue.push_back(AddBase(subvn,indexvn));
}
break;
case CPUI_INT_ADD:
case CPUI_PTRADD: case CPUI_PTRADD:
othervn = op->getIn(1); // Check if something else is being added in besides a constant othervn = op->getIn(1); // Check if something else is being added in besides a constant
if (othervn == vn) if (othervn == vn)
@ -820,7 +833,7 @@ void MapState::reconcileDatatypes(void)
Datatype *curDatatype = curHint->type; Datatype *curDatatype = curHint->type;
if (curDatatype->typeOrder(*startDatatype) < 0) // Take the most specific variant of data-type if (curDatatype->typeOrder(*startDatatype) < 0) // Take the most specific variant of data-type
startDatatype = curDatatype; startDatatype = curDatatype;
if (curHint->compare(*startHint) != 0) if (curHint->compare(*newList.back()) != 0)
newList.push_back(curHint); // Keep the current hint if it is otherwise different newList.push_back(curHint); // Keep the current hint if it is otherwise different
} }
else { else {