diff options
| author | Peter LaFosse <peter@vector35.com> | 2021-10-11 14:36:25 -0400 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2021-10-11 14:59:24 -0400 |
| commit | 3213b7b89136d01c2fc37049f06223fb273450d1 (patch) | |
| tree | 043f81b78cd569167e958d254e6c6c258c3b19e6 /python | |
| parent | 259ef273531f53ee73fe53ea8b147fe59326a31b (diff) | |
Fix LowLevelIL returning an invalid ILSemanticFlagClass
Diffstat (limited to 'python')
| -rw-r--r-- | python/architecture.py | 10 | ||||
| -rw-r--r-- | python/lowlevelil.py | 6 |
2 files changed, 6 insertions, 10 deletions
diff --git a/python/architecture.py b/python/architecture.py index de28dc77..a72760ae 100644 --- a/python/architecture.py +++ b/python/architecture.py @@ -1493,10 +1493,7 @@ class Architecture(metaclass=_ArchitectureMetaClass): """ if not isinstance(class_index, int): raise ValueError("argument 'class_index' must be an integer") - try: - return self._semantic_flag_classes_by_index[class_index] - except KeyError: - raise AttributeError("argument class_index is not a valid class index") + return self._semantic_flag_classes_by_index[class_index] def get_semantic_flag_group_index(self, sem_group:SemanticGroupType) -> SemanticGroupIndex: if isinstance(sem_group, str): @@ -1515,10 +1512,7 @@ class Architecture(metaclass=_ArchitectureMetaClass): """ if not isinstance(group_index, int): raise ValueError("argument 'group_index' must be an integer") - try: - return self._semantic_flag_groups_by_index[group_index] - except KeyError: - raise AttributeError("argument group_index is not a valid group index") + return self._semantic_flag_groups_by_index[group_index] def get_intrinsic_name(self, intrinsic:IntrinsicIndex) -> IntrinsicName: """ diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 1f6914de..7105d996 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -865,7 +865,9 @@ class LowLevelILInstruction: architecture.RegisterStackIndex(self.instr.operands[operand_index1])) return SSARegisterStack(reg_stack, self.instr.operands[operand_index2]) - def get_sem_class(self, operand_index:int) -> ILSemanticFlagClass: + def get_sem_class(self, operand_index:int) -> Optional[ILSemanticFlagClass]: + if self.instr.operands[operand_index] == 0: + return None return ILSemanticFlagClass(self.function.arch, architecture.SemanticClassIndex(self.instr.operands[operand_index])) @@ -1915,7 +1917,7 @@ class LowLevelILFlag_cond(LowLevelILInstruction): return self.get_cond(0) @property - def semantic_class(self) -> ILSemanticFlagClass: + def semantic_class(self) -> Optional[ILSemanticFlagClass]: return self.get_sem_class(1) @property |
