Skip to content

Commit

Permalink
Fix #41 (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
moojek authored May 27, 2023
1 parent 6d58065 commit 10158f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/asm2cfg/asm2cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 10 additions & 0 deletions test/test_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ def test_without_offset(self):
self.assertEqual(address.offset, 0)
self.assertEqual(rest, '')

def test_with_dot(self):
line = '<stdin@GLIBC_2.2.5>'
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):
"""
Expand Down

0 comments on commit 10158f9

Please sign in to comment.