diff --git a/backends/bn_adapter.py b/backends/bn_adapter.py index 487e9d6..e6c38e7 100644 --- a/backends/bn_adapter.py +++ b/backends/bn_adapter.py @@ -306,7 +306,7 @@ def _sanitize_asm(self, text: str, keep_labels: bool = False) -> tuple[str, List if re.match(r"^\s*\.", s): # e.g., .intel_syntax, .text, .globl continue - if re.match(r"^(?i)(global|extern|extrn)\b", s): + if re.match(r"^(global|extern|extrn)\b", s, re.IGNORECASE): continue lines.append(s) mapping.append(idx) diff --git a/backends/validator.py b/backends/validator.py index f5f6d4b..0739715 100644 --- a/backends/validator.py +++ b/backends/validator.py @@ -83,7 +83,8 @@ def _parse_sequence(self, s: str) -> Optional[bytes]: def match_patterns(self, data: bytes) -> List[PatternMatch]: matches: List[PatternMatch] = [] - hexstr = data.hex() + hexstr = " ".join(f"{x:02x}" for x in data) + print(hexstr) for p in self.patterns: if not p.enabled: continue @@ -117,7 +118,7 @@ def match_patterns(self, data: bytes) -> List[PatternMatch]: offs = [] for m in rx.finditer(hexstr): # Map hex index to byte offset: every 2 hex chars per byte - start = m.start() // 2 + start = len(hexstr[: m.start()].replace(" ", "")) // 2 offs.append(start) if offs: matches.append(PatternMatch(pattern=p, offsets=offs))