mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Fix for dropped assignment of string to global variable
This commit is contained in:
parent
074e3ca869
commit
f2dcd4860b
1 changed files with 12 additions and 9 deletions
|
@ -6370,15 +6370,18 @@ int4 RulePtrsubCharConstant::applyOp(PcodeOp *op,Funcdata &data)
|
|||
if (!isstring) return 0;
|
||||
|
||||
// If we reach here, the PTRSUB should be converted to a (COPY of a) pointer constant.
|
||||
list<PcodeOp *>::const_iterator iter,enditer;
|
||||
iter = outvn->beginDescend();
|
||||
enditer = outvn->endDescend();
|
||||
bool removeCopy = true;
|
||||
while(iter != enditer) {
|
||||
PcodeOp *subop = *iter; // Give each descendant of op a chance to further propagate the constant
|
||||
++iter;
|
||||
if (!pushConstFurther(data,outtype,subop,subop->getSlot(outvn),vn1->getOffset()))
|
||||
removeCopy = false; // If the descendant does NOT propagate const, do NOT remove op
|
||||
bool removeCopy = false;
|
||||
if (!outvn->isAddrForce()) {
|
||||
removeCopy = true; // Assume we can remove, unless we can't propagate to all descendants
|
||||
list<PcodeOp *>::const_iterator iter,enditer;
|
||||
iter = outvn->beginDescend();
|
||||
enditer = outvn->endDescend();
|
||||
while(iter != enditer) {
|
||||
PcodeOp *subop = *iter; // Give each descendant of op a chance to further propagate the constant
|
||||
++iter;
|
||||
if (!pushConstFurther(data,outtype,subop,subop->getSlot(outvn),vn1->getOffset()))
|
||||
removeCopy = false; // If the descendant does NOT propagate const, do NOT remove op
|
||||
}
|
||||
}
|
||||
if (removeCopy) {
|
||||
data.opDestroy(op);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue