Skip to content

Commit 0af6340

Browse files
committed
tests, objects: improve coverage (99%) and fix found issues
Signed-off-by: Eloïse Brocas <ebrocas@quarkslab.com>
1 parent 92c8ea1 commit 0af6340

2 files changed

Lines changed: 789 additions & 18 deletions

File tree

src/pyrrha_mapper/common/objects.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ def replace_function(self, new_func: Symbol, old_func: Symbol, keep_old_name: bo
333333
name = old_func.name
334334
else:
335335
name = new_func.name
336-
if self.exported_function_exists(old_func.name):
336+
is_exported = self.exported_function_exists(old_func.name)
337+
self.remove_function(old_func.name)
338+
if is_exported:
337339
self.add_exported_symbol(new_func, symbol_name=name)
338340
else:
339341
self.add_function(new_func, func_name=name)
@@ -595,7 +597,7 @@ def fs_sym_validate(cls, data: Any, info: ValidationInfo) -> Any:
595597
# then recursively resolve symlinks
596598
nb_symlinks = len(res) + len(untreated_symlinks)
597599
while len(res) < nb_symlinks:
598-
for path, content in untreated_symlinks.items():
600+
for path, content in list(untreated_symlinks.items()):
599601
target_path = content["target_path"]
600602
if target_path in res:
601603
content["target"] = res[target_path]
@@ -743,4 +745,4 @@ def resolve_symlink(self, symlink: Symlink) -> Binary | None:
743745
current_symlink = self.get_symlink_by_path(current_symlink.target.path)
744746
if not self.binary_exists(current_symlink.target.path):
745747
return None
746-
return self.get_binary_by_path(current_symlink.target.path)
748+
return self.get_binary_by_path(current_symlink.target.path)

0 commit comments

Comments
 (0)