Handle cases where constant is accessed by address
This commit is contained in:
@@ -63,11 +63,18 @@ class SetGlobalVariablesToZeroIfDetectedReadOnly(EarlyRule):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def check_candidate(self, candidate):
|
def check_candidate(self, candidate):
|
||||||
if candidate["ro_dword"].mop.t != mop_v:
|
mem_read_address = None
|
||||||
return False
|
if candidate["ro_dword"].mop.t == mop_v:
|
||||||
mem_read_address = candidate["ro_dword"].mop.g
|
mem_read_address = candidate["ro_dword"].mop.g
|
||||||
if not self.is_read_only_inited_var(mem_read_address):
|
elif candidate["ro_dword"].mop.t == mop_a:
|
||||||
|
if candidate["ro_dword"].mop.a.t == mop_v:
|
||||||
|
mem_read_address = candidate["ro_dword"].mop.a.g
|
||||||
|
|
||||||
|
if mem_read_address is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if not self.is_read_only_inited_var(mem_read_address):
|
||||||
|
return False
|
||||||
candidate.add_constant_leaf("val_res", 0, candidate["ro_dword"].mop.size)
|
candidate.add_constant_leaf("val_res", 0, candidate["ro_dword"].mop.size)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user