mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-4201 Check for descendants prior to normalizeReadSize
This commit is contained in:
parent
0c58ce9088
commit
0ed3459dbf
2 changed files with 11 additions and 8 deletions
|
@ -331,20 +331,17 @@ bool Heritage::callOpIndirectEffect(const Address &addr,int4 size,PcodeOp *op) c
|
|||
/// of the address range currently being linked, create a Varnode of
|
||||
/// the correct size and define the original Varnode as a SUBPIECE.
|
||||
/// \param vn is the given too small Varnode
|
||||
/// \param op is the reading PcodeOp
|
||||
/// \param addr is the start of the (larger) range
|
||||
/// \param size is the number of bytes in the range
|
||||
/// \return the new larger Varnode
|
||||
Varnode *Heritage::normalizeReadSize(Varnode *vn,const Address &addr,int4 size)
|
||||
Varnode *Heritage::normalizeReadSize(Varnode *vn,PcodeOp *op,const Address &addr,int4 size)
|
||||
|
||||
{
|
||||
int4 overlap;
|
||||
Varnode *vn1,*vn2;
|
||||
PcodeOp *op,*newop;
|
||||
PcodeOp *newop;
|
||||
|
||||
list<PcodeOp *>::const_iterator oiter = vn->beginDescend();
|
||||
op = *oiter++;
|
||||
if (oiter != vn->endDescend())
|
||||
throw LowlevelError("Free varnode with multiple reads");
|
||||
newop = fd->newOp(2,op->getAddr());
|
||||
fd->opSetOpcode(newop,CPUI_SUBPIECE);
|
||||
vn1 = fd->newVarnode(size,addr);
|
||||
|
@ -1122,8 +1119,14 @@ void Heritage::guard(const Address &addr,int4 size,bool guardPerformed,
|
|||
|
||||
for(iter=read.begin();iter!=read.end();++iter) {
|
||||
vn = *iter;
|
||||
list<PcodeOp *>::const_iterator oiter = vn->beginDescend();
|
||||
if (oiter == vn->endDescend()) // removeRevisitedMarkers may have eliminated descendant
|
||||
continue;
|
||||
PcodeOp *op = *oiter++;
|
||||
if (oiter != vn->endDescend())
|
||||
throw LowlevelError("Free varnode with multiple reads");
|
||||
if (vn->getSize() < size)
|
||||
*iter = vn = normalizeReadSize(vn,addr,size);
|
||||
*iter = vn = normalizeReadSize(vn,op,addr,size);
|
||||
vn->setActiveHeritage();
|
||||
}
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ class Heritage {
|
|||
void removeRevisitedMarkers(const vector<Varnode *> &remove,const Address &addr,int4 size);
|
||||
int4 collect(Address addr,int4 size,vector<Varnode *> &read,vector<Varnode *> &write,vector<Varnode *> &input,vector<Varnode *> &remove) const;
|
||||
bool callOpIndirectEffect(const Address &addr,int4 size,PcodeOp *op) const;
|
||||
Varnode *normalizeReadSize(Varnode *vn,const Address &addr,int4 size);
|
||||
Varnode *normalizeReadSize(Varnode *vn,PcodeOp *op,const Address &addr,int4 size);
|
||||
Varnode *normalizeWriteSize(Varnode *vn,const Address &addr,int4 size);
|
||||
Varnode *concatPieces(const vector<Varnode *> &vnlist,PcodeOp *insertop,Varnode *finalvn);
|
||||
void splitPieces(const vector<Varnode *> &vnlist,PcodeOp *insertop,const Address &addr,int4 size,Varnode *startvn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue