mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
Mask off alignment bits in jumptable address generation
This commit is contained in:
parent
dad3d92b72
commit
178dbffe76
1 changed files with 12 additions and 0 deletions
|
@ -1321,12 +1321,18 @@ void JumpBasic::buildAddresses(Funcdata *fd,PcodeOp *indop,vector<Address> &addr
|
||||||
if (loadpoints != (vector<LoadTable> *)0)
|
if (loadpoints != (vector<LoadTable> *)0)
|
||||||
emul.setLoadCollect(true);
|
emul.setLoadCollect(true);
|
||||||
|
|
||||||
|
uintb mask = ~((uintb)0);
|
||||||
|
int4 bit = fd->getArch()->funcptr_align;
|
||||||
|
if (bit != 0) {
|
||||||
|
mask = (mask >> bit) << bit;
|
||||||
|
}
|
||||||
AddrSpace *spc = indop->getAddr().getSpace();
|
AddrSpace *spc = indop->getAddr().getSpace();
|
||||||
bool notdone = jrange->initializeForReading();
|
bool notdone = jrange->initializeForReading();
|
||||||
while(notdone) {
|
while(notdone) {
|
||||||
val = jrange->getValue();
|
val = jrange->getValue();
|
||||||
addr = emul.emulatePath(val,pathMeld,jrange->getStartOp(),jrange->getStartVarnode());
|
addr = emul.emulatePath(val,pathMeld,jrange->getStartOp(),jrange->getStartVarnode());
|
||||||
addr = AddrSpace::addressToByte(addr,spc->getWordSize());
|
addr = AddrSpace::addressToByte(addr,spc->getWordSize());
|
||||||
|
addr &= mask;
|
||||||
addresstable.push_back(Address(spc,addr));
|
addresstable.push_back(Address(spc,addr));
|
||||||
notdone = jrange->next();
|
notdone = jrange->next();
|
||||||
}
|
}
|
||||||
|
@ -2008,9 +2014,15 @@ void JumpAssisted::buildAddresses(Funcdata *fd,PcodeOp *indop,vector<Address> &a
|
||||||
for(int4 i=0;i<numInputs;++i)
|
for(int4 i=0;i<numInputs;++i)
|
||||||
inputs.push_back(assistOp->getIn(i+1)->getOffset());
|
inputs.push_back(assistOp->getIn(i+1)->getOffset());
|
||||||
|
|
||||||
|
uintb mask = ~((uintb)0);
|
||||||
|
int4 bit = fd->getArch()->funcptr_align;
|
||||||
|
if (bit != 0) {
|
||||||
|
mask = (mask >> bit) << bit;
|
||||||
|
}
|
||||||
for(int4 index=0;index<sizeIndices;++index) {
|
for(int4 index=0;index<sizeIndices;++index) {
|
||||||
inputs[0] = index;
|
inputs[0] = index;
|
||||||
uintb output = pcodeScript->evaluate(inputs);
|
uintb output = pcodeScript->evaluate(inputs);
|
||||||
|
output &= mask;
|
||||||
addresstable.push_back(Address(spc,output));
|
addresstable.push_back(Address(spc,output));
|
||||||
}
|
}
|
||||||
ExecutablePcode *defaultScript = (ExecutablePcode *)fd->getArch()->pcodeinjectlib->getPayload(userop->getDefaultAddr());
|
ExecutablePcode *defaultScript = (ExecutablePcode *)fd->getArch()->pcodeinjectlib->getPayload(userop->getDefaultAddr());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue