mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
Some bug fixes for ptr arith
This commit is contained in:
parent
4f1adfcfc0
commit
5332624de8
2 changed files with 14 additions and 3 deletions
|
@ -5928,9 +5928,16 @@ bool AddTreeState::apply(void)
|
|||
preventDistribution = true;
|
||||
spanAddTree(baseOp,1);
|
||||
}
|
||||
calcSubtype();
|
||||
}
|
||||
if (!valid) {
|
||||
// Distribution transforms were made
|
||||
ostringstream s;
|
||||
s << "Problems distributing in pointer arithmetic at ";
|
||||
baseOp->getAddr().printRaw(s);
|
||||
data.warningHeader(s.str());
|
||||
return true;
|
||||
}
|
||||
if (!valid)
|
||||
throw LowlevelError("Problems distributing in ptrarith");
|
||||
buildTree();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1939,10 +1939,14 @@ Datatype *TypeFactory::downChain(Datatype *ptrtype,uintb &off)
|
|||
if (ptrtype->metatype != TYPE_PTR) return (Datatype *)0;
|
||||
TypePointer *ptype = (TypePointer *)ptrtype;
|
||||
Datatype *pt = ptype->ptrto;
|
||||
// If we know we have exactly one of an array, strip the array to get pointer to element
|
||||
bool doStrip = (pt->getMetatype() != TYPE_ARRAY);
|
||||
pt = pt->getSubType(off,&off);
|
||||
if (pt == (Datatype *)0)
|
||||
return (Datatype *)0;
|
||||
return getTypePointerStripArray(ptype->size,pt,ptype->getWordSize());
|
||||
if (doStrip)
|
||||
return getTypePointerStripArray(ptype->size, pt, ptype->getWordSize());
|
||||
return getTypePointer(ptype->size,pt,ptype->getWordSize());
|
||||
}
|
||||
|
||||
/// The data-type propagation system can push around data-types that are \e partial or are
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue