Skip to content

Commit

Permalink
Fixed section name error with LIEF 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dhondta committed Feb 6, 2024
1 parent 43ddb58 commit a3b539b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/reminder/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.0
1.2.1
13 changes: 12 additions & 1 deletion src/reminder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@
}


def _ensure_str(s, encoding='utf-8', errors='strict'):
if isinstance(s, bytes):
try:
return s.decode(encoding, errors)
except:
return s.decode("latin-1")
elif not isinstance(s, (str, bytes)):
raise TypeError("not expecting type '%s'" % type(s))
return s


class REMINDer:
logger = None

Expand All @@ -35,7 +46,7 @@ def detect(self, executable):
if ep_section is None:
return True
# display some debug information
section_name = ep_section.name.rstrip("\x00")
section_name = _ensure_str(ep_section.name).rstrip("\x00")
if self.logger:
self.logger.debug("EP at 0x%.8x in %s" % (ep, section_name))
# now apply the heuristic from https://ieeexplore.ieee.org/document/5404211
Expand Down

0 comments on commit a3b539b

Please sign in to comment.