Skip to content

Commit

Permalink
Fix a crash where config handlers were built with missing binaries
Browse files Browse the repository at this point in the history
Original patch (that itroduces the crash):
Ericsson#4179
Revert attempt in Ericsson#4238.

The crash occurs because the original patch tries to create config
handlers even if they are not supported. This is playing with fire
already, but the crash occured when not even the analyzer binary is
found.

In this patch, these analyzers are skipped from checking if they have
any checkers enabled.
  • Loading branch information
Szelethus committed May 8, 2024
1 parent 1d84767 commit 25f73bb
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 25f73bb

Please sign in to comment.