diff --git a/src/asm2cfg/asm2cfg.py b/src/asm2cfg/asm2cfg.py index 2c426ae..7a93bb4 100644 --- a/src/asm2cfg/asm2cfg.py +++ b/src/asm2cfg/asm2cfg.py @@ -365,7 +365,7 @@ def parse_target(line): """ Parses optional instruction branch target hint """ - target_match = re.match(r'\s*<([a-zA-Z_@0-9]+)([+-]0x[0-9a-f]+|[+-][0-9]+)?>(.*)', line) + target_match = re.match(r'\s*<([a-zA-Z_@.0-9]+)([+-]0x[0-9a-f]+|[+-][0-9]+)?>(.*)', line) if target_match is None: return None, line offset = target_match[2] or '+0' diff --git a/test/test_regex.py b/test/test_regex.py index 79077ab..801d2a8 100644 --- a/test/test_regex.py +++ b/test/test_regex.py @@ -154,6 +154,16 @@ def test_without_offset(self): self.assertEqual(address.offset, 0) self.assertEqual(rest, '') + def test_with_dot(self): + line = '' + address, rest = asm2cfg.parse_target(line) + + self.assertIsNot(address, None) + self.assertIs(address.abs, None) + self.assertEqual(address.base, 'stdin@GLIBC_2.2.5') + self.assertEqual(address.offset, 0) + self.assertEqual(rest, '') + class ParseCommentTestCase(unittest.TestCase): """