Skip to content

Commit

Permalink
report-converter: Parse all leaks reported by LeakSanitizer
Browse files Browse the repository at this point in the history
Previously, report-converter was able to parse output by LeakSanitizer
only, if exactly one leak was found. This issue was reported as Ericsson#3617.

By changing the regex to find the beginning of a single leak - instead
of finding the beginning of the entire LeakSanitizer report -
report-converter is now able to parse and convert LeakSanitizer output
with multiple leaks

The new line regex necessitates not skipping an empty line, which is
still required for 'old style' parsers, which can only parse one item
 - like ASan. For this reason the 'skip_line_after_match' attribute
has been introduced. When all sanitizer convers are able to parse multiple
defects, this attribute can be removed again.
hannesweisbach authored and Hannes Weisbach committed Sep 29, 2022
1 parent 32c0901 commit f0ccd0b
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ class Parser(SANParser):

# Regex for parsing MemorySanitizer output message.
line_re = re.compile(
# Error code
r'==(?P<code>\d+)==(ERROR|WARNING): LeakSanitizer: '
# Checker message.
r'(?P<message>[\S \t]+)')
r'(?P<message>(Ind|D)irect leak of \d+ byte\(s\) '
r'in \d+ object\(s\) allocated from:)')

skip_line_after_match = False
Original file line number Diff line number Diff line change
@@ -52,7 +52,8 @@ def parse_sanitizer_message(
if not match:
return None, line

line = get_next(it)
if getattr(self, 'skip_line_after_match', True):
line = get_next(it)
stack_traces, events, line = self.parse_stack_trace(it, line)

if not events:

0 comments on commit f0ccd0b

Please sign in to comment.