Skip to content

Commit

Permalink
Merge pull request #4241 from Szelethus/fix_no_checker_enabled_crash
Browse files Browse the repository at this point in the history
Fix a crash where config handlers were built with missing binaries
  • Loading branch information
bruntib authored May 16, 2024
2 parents d827fc4 + 25f73bb commit a7a4495
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions analyzer/codechecker_analyzer/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,16 @@ def perform_analysis(args, skip_handlers, rs_handler: ReviewStatusHandler,
# TODO: Its perfectly reasonable for an analyzer plugin to not be able to
# build their config handler if the analyzer isn't supported in the first
# place. For now, this seems to be okay, but may not be later.
# Even then, if we couldn't get hold of the analyzer binary, we can't do
# anything.
errored_config_map = analyzer_types.build_config_handlers(
args, [x for (x, _) in errored])
args,
[x for (x, _) in errored
if analyzer_types.supported_analyzers[x].analyzer_binary()])

no_checker_err_analyzers = \
[a for (a, _) in errored
if not __has_enabled_checker(errored_config_map[a])]
[analyzer for analyzer, config_h in errored_config_map.items()
if not __has_enabled_checker(config_h)]

errored = [(an, msg) for an, msg in errored
if an not in no_checker_err_analyzers]
Expand Down
3 changes: 3 additions & 0 deletions analyzer/codechecker_analyzer/analyzers/analyzer_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ def build_config_handlers(args, enabled_analyzers):
analyzer_config_map = {}

for ea in enabled_analyzers:
assert supported_analyzers[ea].analyzer_binary(), \
"At this point, we should've checked if this analyzer has a " \
"binary!"
config_handler = supported_analyzers[ea].construct_config_handler(args)
analyzer_config_map[ea] = config_handler

Expand Down

0 comments on commit a7a4495

Please sign in to comment.