|
|
|
@ -57,7 +57,8 @@ let immediate_or_first_call calling_context (trace : Trace.t) =
|
|
|
|
|
let get_message diagnostic =
|
|
|
|
|
let pulse_start_msg = "Pulse found a potential" in
|
|
|
|
|
match diagnostic with
|
|
|
|
|
| AccessToInvalidAddress {calling_context; invalidation; invalidation_trace; access_trace} -> (
|
|
|
|
|
| AccessToInvalidAddress
|
|
|
|
|
{calling_context; invalidation; invalidation_trace; access_trace; must_be_valid_reason} -> (
|
|
|
|
|
let invalidation, invalidation_trace =
|
|
|
|
|
Trace.get_invalidation access_trace
|
|
|
|
|
|> Option.value_map
|
|
|
|
@ -67,6 +68,14 @@ let get_message diagnostic =
|
|
|
|
|
match invalidation with
|
|
|
|
|
| ConstantDereference i when IntLit.equal i IntLit.zero ->
|
|
|
|
|
(* Special error message for nullptr dereference *)
|
|
|
|
|
let issue_kind_str =
|
|
|
|
|
match must_be_valid_reason with
|
|
|
|
|
| Some (Invalidation.SelfOfNonPODReturnMethod non_pod_typ) ->
|
|
|
|
|
F.asprintf "undefined behaviour caused by nil messaging of non-pod return type (%a)"
|
|
|
|
|
(Typ.pp Pp.text) non_pod_typ
|
|
|
|
|
| _ ->
|
|
|
|
|
F.sprintf "null pointer dereference"
|
|
|
|
|
in
|
|
|
|
|
let pp_access_trace fmt (trace : Trace.t) =
|
|
|
|
|
match immediate_or_first_call calling_context trace with
|
|
|
|
|
| `Immediate ->
|
|
|
|
@ -78,10 +87,10 @@ let get_message diagnostic =
|
|
|
|
|
let pp_line fmt line = F.fprintf fmt "on line %d" line in
|
|
|
|
|
match immediate_or_first_call calling_context trace with
|
|
|
|
|
| `Immediate ->
|
|
|
|
|
F.fprintf fmt "null pointer dereference %a" pp_line line
|
|
|
|
|
F.fprintf fmt "%s %a" issue_kind_str pp_line line
|
|
|
|
|
| `Call f ->
|
|
|
|
|
F.fprintf fmt "null pointer dereference %a indirectly during the call to %a" pp_line
|
|
|
|
|
line CallEvent.describe f
|
|
|
|
|
F.fprintf fmt "%s %a indirectly during the call to %a" issue_kind_str pp_line line
|
|
|
|
|
CallEvent.describe f
|
|
|
|
|
in
|
|
|
|
|
let invalidation_line =
|
|
|
|
|
let {Location.line; _} = Trace.get_outer_location invalidation_trace in
|
|
|
|
|