|
@@ -69,7 +69,12 @@ class BaseBinary:
|
|
|
def mmap(self):
|
|
|
mm = mmap.mmap(self._file.fileno(), 0, access=mmap.ACCESS_READ)
|
|
|
yield mm
|
|
|
- mm.close()
|
|
|
+
|
|
|
+ # FIXME: We currently don't close this because an error gets thrown at
|
|
|
+ # ``LocationEntry.calculate_phys_address()`` due to exported pointers. It's not
|
|
|
+ # clear to me if the issue stems from ``ByteSignature.expr.finditer()`` or
|
|
|
+ # something else at this point.
|
|
|
+ # mm.close()
|
|
|
|
|
|
def read(self, address, size) -> bytes:
|
|
|
# shorthand to read a value from a physical file
|
|
@@ -211,6 +216,18 @@ class ByteSigEntry(LocationEntry, tag="bytesig", kw_only=True):
|
|
|
allow_multiple: bool = False
|
|
|
|
|
|
def process(self, bin: PlatformBinary) -> ResultValues:
|
|
|
+ if self.symbol or self.bytescan:
|
|
|
+ address = self.calculate_phys_address(bin)
|
|
|
+ data = bin.read(address, self.contents.length)
|
|
|
+ if not self.contents.expr.match(data):
|
|
|
+ actual_disp = f"[{data.hex(' ')}]"
|
|
|
+ raise AssertionError(
|
|
|
+ f"Assertion failed: {self.contents.display_str} != {actual_disp}"
|
|
|
+ )
|
|
|
+ return {
|
|
|
+ KEY_AS_IS: self.contents.gameconf_str,
|
|
|
+ }
|
|
|
+
|
|
|
with bin.mmap() as memory:
|
|
|
matches = self.contents.expr.finditer(memory)
|
|
|
match = next(matches, False)
|