Skip to content

Commit

Permalink
[ondemand] do not crash if the analysis of the default summary fails
Browse files Browse the repository at this point in the history
Summary:
When analysing a procedure for a specialised summary and that procedure
has no default summary, we first compute the default summary. But if
that analysis fails, we crash. However, there could be a timeout
analysing the default summary, or any random reason why analyses fail.
We normally return `Error _` for these failures instead of crashing so
we shoud do the same in this edge case too.

Reviewed By: ngorogiannis

Differential Revision:
D63464980

Privacy Context Container: L1208441

fbshipit-source-id: facefbdc4aff122cece9b168595206f71e097a81
  • Loading branch information
jvillard authored and facebook-github-bot committed Sep 26, 2024
1 parent 898d0f0 commit 995d569
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions infer/src/backend/ondemand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -441,17 +441,12 @@ let rec analyze_callee exe_env ~lazy_payloads (analysis_req : AnalysisRequest.t)
Ok summary
| `ComputeDefaultSummary ->
analyze_callee_aux None |> analysis_result_of_option
| `ComputeDefaultSummaryThenSpecialize specialization -> (
(* recursive call so that we detect mutual recursion on the unspecialized summary *)
match
| `ComputeDefaultSummaryThenSpecialize specialization ->
(* recursive call so that we detect mutual recursion on the unspecialized summary *)
analyze_callee exe_env ~lazy_payloads analysis_req ~specialization:None ?caller_summary
~from_file_analysis callee_pname
with
| Error _ ->
L.die InternalError "Failed to analyze %a with specialization %a" Procname.pp callee_pname
Specialization.pp specialization
| Ok summary ->
analyze_callee_aux (Some (summary, specialization)) |> analysis_result_of_option )
|> Result.bind ~f:(fun summary ->
analyze_callee_aux (Some (summary, specialization)) |> analysis_result_of_option )
| `AddNewSpecialization (summary, specialization) ->
analyze_callee_aux (Some (summary, specialization)) |> analysis_result_of_option
| `UnknownProcedure ->
Expand Down

0 comments on commit 995d569

Please sign in to comment.