@ -29,56 +29,62 @@ type err_class = Checker | Prover | Nocat
type err_kind =
type err_kind =
Kwarning | Kerror | Kinfo
Kwarning | Kerror | Kinfo
exception Abduction_case_not_implemented of ml_loc ation
exception Abduction_case_not_implemented of ml_loc
exception Analysis_stops of Localise . error_desc * ml_loc ation option
exception Analysis_stops of Localise . error_desc * ml_loc option
exception Array_out_of_bounds_l1 of Localise . error_desc * ml_loc ation
exception Array_out_of_bounds_l1 of Localise . error_desc * ml_loc
exception Array_out_of_bounds_l2 of Localise . error_desc * ml_loc ation
exception Array_out_of_bounds_l2 of Localise . error_desc * ml_loc
exception Array_out_of_bounds_l3 of Localise . error_desc * ml_loc ation
exception Array_out_of_bounds_l3 of Localise . error_desc * ml_loc
exception Array_of_pointsto of ml_loc ation
exception Array_of_pointsto of ml_loc
exception Bad_footprint of ml_loc ation
exception Bad_footprint of ml_loc
exception Bad_pointer_comparison of Localise . error_desc * ml_loc ation
exception Bad_pointer_comparison of Localise . error_desc * ml_loc
exception Class_cast_exception of Localise . error_desc * ml_loc ation
exception Class_cast_exception of Localise . error_desc * ml_loc
exception Codequery of Localise . error_desc
exception Codequery of Localise . error_desc
exception Comparing_floats_for_equality of Localise . error_desc * ml_loc ation
exception Comparing_floats_for_equality of Localise . error_desc * ml_loc
exception Condition_is_assignment of Localise . error_desc * ml_loc ation
exception Condition_is_assignment of Localise . error_desc * ml_loc
exception Condition_always_true_false of Localise . error_desc * bool * ml_loc ation
exception Condition_always_true_false of Localise . error_desc * bool * ml_loc
exception Context_leak of Localise . error_desc * ml_loc ation
exception Context_leak of Localise . error_desc * ml_loc
exception Custom_error of string * Localise . error_desc
exception Custom_error of string * Localise . error_desc
exception Dangling_pointer_dereference of Sil . dangling_kind option * Localise . error_desc * ml_loc ation
exception Dangling_pointer_dereference of Sil . dangling_kind option * Localise . error_desc * ml_loc
exception Deallocate_stack_variable of Localise . error_desc
exception Deallocate_stack_variable of Localise . error_desc
exception Deallocate_static_memory of Localise . error_desc
exception Deallocate_static_memory of Localise . error_desc
exception Deallocation_mismatch of Localise . error_desc * ml_loc ation
exception Deallocation_mismatch of Localise . error_desc * ml_loc
exception Divide_by_zero of Localise . error_desc * ml_loc ation
exception Divide_by_zero of Localise . error_desc * ml_loc
exception Eradicate of string * Localise . error_desc
exception Eradicate of string * Localise . error_desc
exception Field_not_null_checked of Localise . error_desc * ml_loc ation
exception Field_not_null_checked of Localise . error_desc * ml_loc
exception Frontend_warning of string * Localise . error_desc * ml_loc ation
exception Frontend_warning of string * Localise . error_desc * ml_loc
exception Checkers of string * Localise . error_desc
exception Checkers of string * Localise . error_desc
exception Inherently_dangerous_function of Localise . error_desc
exception Inherently_dangerous_function of Localise . error_desc
exception Internal_error of Localise . error_desc
exception Internal_error of Localise . error_desc
exception Java_runtime_exception of Typename . t * string * Localise . error_desc
exception Java_runtime_exception of Typename . t * string * Localise . error_desc
exception Leak of bool * Prop . normal Prop . t * Sil . hpred * ( exception_visibility * Localise . error_desc ) * bool * Sil . resource * ml_location
exception Leak of
exception Missing_fld of Ident . fieldname * ml_location
bool * Prop . normal Prop . t * Sil . hpred * ( exception_visibility * Localise . error_desc )
exception Premature_nil_termination of Localise . error_desc * ml_location
* bool * Sil . resource * ml_loc
exception Null_dereference of Localise . error_desc * ml_location
exception Missing_fld of Ident . fieldname * ml_loc
exception Null_test_after_dereference of Localise . error_desc * ml_location
exception Premature_nil_termination of Localise . error_desc * ml_loc
exception Parameter_not_null_checked of Localise . error_desc * ml_location
exception Null_dereference of Localise . error_desc * ml_loc
exception Pointer_size_mismatch of Localise . error_desc * ml_location
exception Null_test_after_dereference of Localise . error_desc * ml_loc
exception Precondition_not_found of Localise . error_desc * ml_location
exception Parameter_not_null_checked of Localise . error_desc * ml_loc
exception Precondition_not_met of Localise . error_desc * ml_location
exception Pointer_size_mismatch of Localise . error_desc * ml_loc
exception Retain_cycle of Prop . normal Prop . t * Sil . hpred * Localise . error_desc * ml_location
exception Precondition_not_found of Localise . error_desc * ml_loc
exception Return_expression_required of Localise . error_desc * ml_location
exception Precondition_not_met of Localise . error_desc * ml_loc
exception Return_statement_missing of Localise . error_desc * ml_location
exception Retain_cycle of Prop . normal Prop . t * Sil . hpred * Localise . error_desc * ml_loc
exception Return_value_ignored of Localise . error_desc * ml_location
exception Return_expression_required of Localise . error_desc * ml_loc
exception Return_statement_missing of Localise . error_desc * ml_loc
exception Return_value_ignored of Localise . error_desc * ml_loc
exception Skip_function of Localise . error_desc
exception Skip_function of Localise . error_desc
exception Skip_pointer_dereference of Localise . error_desc * ml_location
exception Skip_pointer_dereference of Localise . error_desc * ml_loc
exception Stack_variable_address_escape of Localise . error_desc * ml_loc ation
exception Stack_variable_address_escape of Localise . error_desc * ml_loc
exception Symexec_memory_error of ml_loc ation
exception Symexec_memory_error of ml_loc
exception Tainted_value_reaching_sensitive_function of Localise . error_desc * ml_loc ation
exception Tainted_value_reaching_sensitive_function of Localise . error_desc * ml_loc
exception Unary_minus_applied_to_unsigned_expression of Localise . error_desc * ml_loc ation
exception Unary_minus_applied_to_unsigned_expression of Localise . error_desc * ml_loc
exception Uninitialized_value of Localise . error_desc * ml_loc ation
exception Uninitialized_value of Localise . error_desc * ml_loc
exception Unknown_proc
exception Unknown_proc
exception Use_after_free of Localise . error_desc * ml_location
exception Use_after_free of Localise . error_desc * ml_loc
exception Wrong_argument_number of ml_location
exception Wrong_argument_number of ml_loc
let file_line_column_string ( file , line , column ) =
Printf . sprintf " file %s line %d column %d " file line column
(* * Turn an exception into a descriptive string, error description, location in ml source, and category *)
(* * Turn an exception into a descriptive string, error description, location in ml source, and category *)
let recognize_exception exn =
let recognize_exception exn =
@ -87,161 +93,220 @@ let recognize_exception exn =
match Localise . error_desc_get_bucket desc with
match Localise . error_desc_get_bucket desc with
| None -> false
| None -> false
| Some bucket -> bucket < > Localise . BucketLevel . b1 in
| Some bucket -> bucket < > Localise . BucketLevel . b1 in
let err_name , desc , mloco , visibility , severity , force_kind , eclass = match exn with (* all the names of Exn_user errors must be defined in Localise *)
let err_name , desc , ( ml_loc_opt : ml_loc option ) , visibility , severity , force_kind , eclass =
| Abduction_case_not_implemented mloc ->
match exn with (* all the names of Exn_user errors must be defined in Localise *)
( Localise . from_string " Abduction_case_not_implemented " , Localise . no_desc , Some mloc , Exn_developer , Low , None , Nocat )
| Abduction_case_not_implemented ml_loc ->
( Localise . from_string " Abduction_case_not_implemented " ,
Localise . no_desc , Some ml_loc , Exn_developer , Low , None , Nocat )
| Context_leak ( desc , _ ) ->
| Context_leak ( desc , _ ) ->
( Localise . context_leak , desc , None , Exn_user , High , None , Nocat )
( Localise . context_leak ,
| Analysis_stops ( desc , mloco ) ->
desc , None , Exn_user , High , None , Nocat )
| Analysis_stops ( desc , ml_loc_opt ) ->
let visibility = if ! Config . analysis_stops then Exn_user else Exn_developer in
let visibility = if ! Config . analysis_stops then Exn_user else Exn_developer in
( Localise . analysis_stops , desc , mloco , visibility , Medium , None , Nocat )
( Localise . analysis_stops , desc , ml_loc_opt , visibility , Medium , None , Nocat )
| Array_of_pointsto mloc ->
| Array_of_pointsto ml_loc ->
( Localise . from_string " Array_of_pointsto " , Localise . no_desc , Some mloc , Exn_developer , Low , None , Nocat )
( Localise . from_string " Array_of_pointsto " ,
| Array_out_of_bounds_l1 ( desc , mloc ) ->
Localise . no_desc , Some ml_loc , Exn_developer , Low , None , Nocat )
( Localise . array_out_of_bounds_l1 , desc , Some mloc , Exn_user , High , Some Kerror , Checker )
| Array_out_of_bounds_l1 ( desc , ml_loc ) ->
| Array_out_of_bounds_l2 ( desc , mloc ) ->
( Localise . array_out_of_bounds_l1 ,
( Localise . array_out_of_bounds_l2 , desc , Some mloc , Exn_user , Medium , None , Nocat )
desc , Some ml_loc , Exn_user , High , Some Kerror , Checker )
| Array_out_of_bounds_l3 ( desc , mloc ) ->
| Array_out_of_bounds_l2 ( desc , ml_loc ) ->
( Localise . array_out_of_bounds_l3 , desc , Some mloc , Exn_developer , Medium , None , Nocat )
( Localise . array_out_of_bounds_l2 ,
| Assert_failure mloc ->
desc , Some ml_loc , Exn_user , Medium , None , Nocat )
( Localise . from_string " Assert_failure " , Localise . no_desc , Some mloc , Exn_developer , High , None , Nocat )
| Array_out_of_bounds_l3 ( desc , ml_loc ) ->
| Bad_pointer_comparison ( desc , mloc ) ->
( Localise . array_out_of_bounds_l3 ,
( Localise . bad_pointer_comparison , desc , Some mloc , Exn_user , High , Some Kerror , Prover )
desc , Some ml_loc , Exn_developer , Medium , None , Nocat )
| Bad_footprint mloc ->
| Assert_failure ( f , l , c ) ->
( Localise . from_string " Bad_footprint " , Localise . no_desc , Some mloc , Exn_developer , Low , None , Nocat )
let ml_loc = ( f , l , c , c ) in
| Prop . Cannot_star mloc ->
( Localise . from_string " Assert_failure " ,
( Localise . from_string " Cannot_star " , Localise . no_desc , Some mloc , Exn_developer , Low , None , Nocat )
Localise . no_desc , Some ml_loc , Exn_developer , High , None , Nocat )
| Class_cast_exception ( desc , mloc ) ->
| Bad_pointer_comparison ( desc , ml_loc ) ->
( Localise . class_cast_exception , desc , Some mloc , Exn_user , High , None , Prover )
( Localise . bad_pointer_comparison ,
desc , Some ml_loc , Exn_user , High , Some Kerror , Prover )
| Bad_footprint ml_loc ->
( Localise . from_string " Bad_footprint " ,
Localise . no_desc , Some ml_loc , Exn_developer , Low , None , Nocat )
| Prop . Cannot_star ml_loc ->
( Localise . from_string " Cannot_star " ,
Localise . no_desc , Some ml_loc , Exn_developer , Low , None , Nocat )
| Class_cast_exception ( desc , ml_loc ) ->
( Localise . class_cast_exception ,
desc , Some ml_loc , Exn_user , High , None , Prover )
| Codequery desc ->
| Codequery desc ->
( Localise . from_string " Codequery " , desc , None , Exn_user , High , None , Prover )
( Localise . from_string " Codequery " ,
| Comparing_floats_for_equality ( desc , mloc ) ->
desc , None , Exn_user , High , None , Prover )
( Localise . comparing_floats_for_equality , desc , Some mloc , Exn_user , Medium , None , Nocat )
| Comparing_floats_for_equality ( desc , ml_loc ) ->
| Condition_always_true_false ( desc , b , mloc ) ->
( Localise . comparing_floats_for_equality ,
let name = if b then Localise . condition_always_true else Localise . condition_always_false in
desc , Some ml_loc , Exn_user , Medium , None , Nocat )
( name , desc , Some mloc , Exn_user , Medium , None , Nocat )
| Condition_always_true_false ( desc , b , ml_loc ) ->
let name =
if b then Localise . condition_always_true
else Localise . condition_always_false in
( name , desc , Some ml_loc , Exn_user , Medium , None , Nocat )
| Custom_error ( error_msg , desc ) ->
| Custom_error ( error_msg , desc ) ->
( Localise . from_string error_msg , desc , None , Exn_user , High , None , Checker )
( Localise . from_string error_msg ,
| Condition_is_assignment ( desc , mloc ) ->
desc , None , Exn_user , High , None , Checker )
( Localise . condition_is_assignment , desc , Some mloc , Exn_user , Medium , None , Nocat )
| Condition_is_assignment ( desc , ml_loc ) ->
| Dangling_pointer_dereference ( dko , desc , mloc ) ->
( Localise . condition_is_assignment ,
desc , Some ml_loc , Exn_user , Medium , None , Nocat )
| Dangling_pointer_dereference ( dko , desc , ml_loc ) ->
let visibility = match dko with
let visibility = match dko with
| Some dk -> Exn_user (* only show to the user if the category was identified *)
| Some dk -> Exn_user (* only show to the user if the category was identified *)
| None -> Exn_developer in
| None -> Exn_developer in
( Localise . dangling_pointer_dereference , desc , Some mloc , visibility , High , None , Prover )
( Localise . dangling_pointer_dereference ,
desc , Some ml_loc , visibility , High , None , Prover )
| Deallocate_stack_variable desc ->
| Deallocate_stack_variable desc ->
( Localise . deallocate_stack_variable , desc , None , Exn_user , High , None , Prover )
( Localise . deallocate_stack_variable ,
desc , None , Exn_user , High , None , Prover )
| Deallocate_static_memory desc ->
| Deallocate_static_memory desc ->
( Localise . deallocate_static_memory , desc , None , Exn_user , High , None , Prover )
( Localise . deallocate_static_memory ,
| Deallocation_mismatch ( desc , mloc ) ->
desc , None , Exn_user , High , None , Prover )
( Localise . deallocation_mismatch , desc , Some mloc , Exn_user , High , None , Prover )
| Deallocation_mismatch ( desc , ml_loc ) ->
| Divide_by_zero ( desc , mloc ) ->
( Localise . deallocation_mismatch ,
( Localise . divide_by_zero , desc , Some mloc , Exn_user , High , Some Kerror , Checker )
desc , Some ml_loc , Exn_user , High , None , Prover )
| Divide_by_zero ( desc , ml_loc ) ->
( Localise . divide_by_zero ,
desc , Some ml_loc , Exn_user , High , Some Kerror , Checker )
| Eradicate ( kind_s , desc ) ->
| Eradicate ( kind_s , desc ) ->
( Localise . from_string kind_s , desc , None , Exn_user , High , None , Prover )
( Localise . from_string kind_s , desc , None , Exn_user , High , None , Prover )
| Field_not_null_checked ( desc , mloc ) ->
| Field_not_null_checked ( desc , ml_loc ) ->
( Localise . field_not_null_checked , desc , Some mloc , Exn_user , Medium , Some Kwarning , Nocat )
( Localise . field_not_null_checked ,
| Frontend_warning ( name , desc , mloc ) ->
desc , Some ml_loc , Exn_user , Medium , Some Kwarning , Nocat )
( Localise . from_string name , desc , Some mloc , Exn_user , Medium , Some Kwarning , Nocat )
| Frontend_warning ( name , desc , ml_loc ) ->
( Localise . from_string name ,
desc , Some ml_loc , Exn_user , Medium , Some Kwarning , Nocat )
| Checkers ( kind_s , desc ) ->
| Checkers ( kind_s , desc ) ->
( Localise . from_string kind_s , desc , None , Exn_user , High , None , Prover )
( Localise . from_string kind_s ,
| Null_dereference ( desc , mloc ) ->
desc , None , Exn_user , High , None , Prover )
( Localise . null_dereference , desc , Some mloc , Exn_user , High , None , Prover )
| Null_dereference ( desc , ml_loc ) ->
| Null_test_after_dereference ( desc , mloc ) ->
( Localise . null_dereference ,
( Localise . null_test_after_dereference , desc , Some mloc , Exn_user , High , None , Nocat )
desc , Some ml_loc , Exn_user , High , None , Prover )
| Pointer_size_mismatch ( desc , mloc ) ->
| Null_test_after_dereference ( desc , ml_loc ) ->
( Localise . pointer_size_mismatch , desc , Some mloc , Exn_user , High , Some Kerror , Checker )
( Localise . null_test_after_dereference ,
desc , Some ml_loc , Exn_user , High , None , Nocat )
| Pointer_size_mismatch ( desc , ml_loc ) ->
( Localise . pointer_size_mismatch ,
desc , Some ml_loc , Exn_user , High , Some Kerror , Checker )
| Inherently_dangerous_function desc ->
| Inherently_dangerous_function desc ->
( Localise . inherently_dangerous_function , desc , None , Exn_developer , Medium , None , Nocat )
( Localise . inherently_dangerous_function ,
desc , None , Exn_developer , Medium , None , Nocat )
| Internal_error desc ->
| Internal_error desc ->
( Localise . from_string " Internal_error " , desc , None , Exn_developer , High , None , Nocat )
( Localise . from_string " Internal_error " ,
desc , None , Exn_developer , High , None , Nocat )
| Invalid_argument s ->
| Invalid_argument s ->
let desc = Localise . verbatim_desc s in
let desc = Localise . verbatim_desc s in
( Localise . from_string " Invalid_argument " , desc , None , Exn_system , Low , None , Nocat )
( Localise . from_string " Invalid_argument " , desc , None , Exn_system , Low , None , Nocat )
| Java_runtime_exception ( exn_name , pre_str , desc ) ->
| Java_runtime_exception ( exn_name , pre_str , desc ) ->
let exn_str = Typename . name exn_name in
let exn_str = Typename . name exn_name in
( Localise . from_string exn_str , desc , None , Exn_user , High , None , Prover )
( Localise . from_string exn_str , desc , None , Exn_user , High , None , Prover )
| Leak ( fp_part , _ , _ , ( exn_vis , error_desc ) , done_array_abstraction , resource , ml oc) ->
| Leak ( fp_part , _ , _ , ( exn_vis , error_desc ) , done_array_abstraction , resource , ml _l oc) ->
if done_array_abstraction
if done_array_abstraction
then ( Localise . from_string " Leak_after_array_abstraction " , error_desc , Some mloc , Exn_developer , High , None , Prover )
then ( Localise . from_string " Leak_after_array_abstraction " ,
error_desc , Some ml_loc , Exn_developer , High , None , Prover )
else if fp_part
else if fp_part
then ( Localise . from_string " Leak_in_footprint " , error_desc , Some mloc , Exn_developer , High , None , Prover )
then ( Localise . from_string " Leak_in_footprint " ,
error_desc , Some ml_loc , Exn_developer , High , None , Prover )
else
else
let loc_str = match resource with
let loc_str = match resource with
| Sil . Rmemory _ -> Localise . memory_leak
| Sil . Rmemory _ -> Localise . memory_leak
| Sil . Rfile -> Localise . resource_leak
| Sil . Rfile -> Localise . resource_leak
| Sil . Rlock -> Localise . resource_leak
| Sil . Rlock -> Localise . resource_leak
| Sil . Rignore -> Localise . memory_leak in
| Sil . Rignore -> Localise . memory_leak in
( loc_str , error_desc , Some mloc , exn_vis , High , None , Prover )
( loc_str , error_desc , Some ml_loc , exn_vis , High , None , Prover )
| Match_failure mloc ->
| Match_failure ( f , l , c ) ->
( Localise . from_string " Match failure " , Localise . no_desc , Some mloc , Exn_developer , High , None , Nocat )
let ml_loc = ( f , l , c , c ) in
| Missing_fld ( fld , mloc ) ->
( Localise . from_string " Match failure " ,
Localise . no_desc , Some ml_loc , Exn_developer , High , None , Nocat )
| Missing_fld ( fld , ml_loc ) ->
let desc = Localise . verbatim_desc ( Ident . fieldname_to_string fld ) in
let desc = Localise . verbatim_desc ( Ident . fieldname_to_string fld ) in
( Localise . from_string " Missing_fld " , desc , Some mloc , Exn_developer , Medium , None , Nocat )
( Localise . from_string " Missing_fld " , desc , Some ml_loc , Exn_developer , Medium , None , Nocat )
| Premature_nil_termination ( desc , mloc ) ->
| Premature_nil_termination ( desc , ml_loc ) ->
( Localise . premature_nil_termination , desc , Some mloc , Exn_user , High , None , Prover )
( Localise . premature_nil_termination ,
desc , Some ml_loc , Exn_user , High , None , Prover )
| Not_found ->
| Not_found ->
( Localise . from_string " Not_found " , Localise . no_desc , None , Exn_system , Low , None , Nocat )
( Localise . from_string " Not_found " ,
| Parameter_not_null_checked ( desc , mloc ) ->
Localise . no_desc , None , Exn_system , Low , None , Nocat )
( Localise . parameter_not_null_checked , desc , Some mloc , Exn_user , Medium , Some Kwarning , Nocat )
| Parameter_not_null_checked ( desc , ml_loc ) ->
| Precondition_not_found ( desc , mloc ) ->
( Localise . parameter_not_null_checked ,
( Localise . precondition_not_found , desc , Some mloc , Exn_developer , Low , None , Nocat )
desc , Some ml_loc , Exn_user , Medium , Some Kwarning , Nocat )
| Precondition_not_met ( desc , mloc ) ->
| Precondition_not_found ( desc , ml_loc ) ->
( Localise . precondition_not_met , desc , Some mloc , Exn_user , Medium , Some Kwarning , Nocat ) (* * always a warning *)
( Localise . precondition_not_found ,
| Retain_cycle ( prop , hpred , desc , mloc ) ->
desc , Some ml_loc , Exn_developer , Low , None , Nocat )
( Localise . retain_cycle , desc , Some mloc , Exn_user , High , None , Prover )
| Precondition_not_met ( desc , ml_loc ) ->
| Return_expression_required ( desc , mloc ) ->
( Localise . precondition_not_met ,
( Localise . return_expression_required , desc , Some mloc , Exn_user , Medium , None , Nocat )
desc , Some ml_loc , Exn_user , Medium , Some Kwarning , Nocat ) (* * always a warning *)
| Stack_variable_address_escape ( desc , mloc ) ->
| Retain_cycle ( prop , hpred , desc , ml_loc ) ->
( Localise . stack_variable_address_escape , desc , Some mloc , Exn_user , High , Some Kerror , Nocat )
( Localise . retain_cycle ,
| Return_statement_missing ( desc , mloc ) ->
desc , Some ml_loc , Exn_user , High , None , Prover )
( Localise . return_statement_missing , desc , Some mloc , Exn_user , Medium , None , Nocat )
| Return_expression_required ( desc , ml_loc ) ->
| Return_value_ignored ( desc , mloc ) ->
( Localise . return_expression_required ,
( Localise . return_value_ignored , desc , Some mloc , Exn_user , Medium , None , Nocat )
desc , Some ml_loc , Exn_user , Medium , None , Nocat )
| Stack_variable_address_escape ( desc , ml_loc ) ->
( Localise . stack_variable_address_escape ,
desc , Some ml_loc , Exn_user , High , Some Kerror , Nocat )
| Return_statement_missing ( desc , ml_loc ) ->
( Localise . return_statement_missing ,
desc , Some ml_loc , Exn_user , Medium , None , Nocat )
| Return_value_ignored ( desc , ml_loc ) ->
( Localise . return_value_ignored ,
desc , Some ml_loc , Exn_user , Medium , None , Nocat )
| Analysis_failure_exe _ ->
| Analysis_failure_exe _ ->
( Localise . from_string " Failure_exe " , Localise . no_desc , None , Exn_system , Low , None , Nocat )
( Localise . from_string " Failure_exe " ,
Localise . no_desc , None , Exn_system , Low , None , Nocat )
| Skip_function desc ->
| Skip_function desc ->
( Localise . skip_function , desc , None , Exn_developer , Low , None , Nocat )
( Localise . skip_function , desc , None , Exn_developer , Low , None , Nocat )
| Skip_pointer_dereference ( desc , mloc ) ->
| Skip_pointer_dereference ( desc , ml_loc ) ->
( Localise . skip_pointer_dereference , desc , Some mloc , Exn_user , Medium , Some Kinfo , Nocat ) (* * always an info *)
( Localise . skip_pointer_dereference ,
| Symexec_memory_error mloc ->
desc , Some ml_loc , Exn_user , Medium , Some Kinfo , Nocat ) (* * always an info *)
( Localise . from_string " Symexec_memory_error " , Localise . no_desc , Some mloc , Exn_developer , Low , None , Nocat )
| Symexec_memory_error ml_loc ->
( Localise . from_string " Symexec_memory_error " ,
Localise . no_desc , Some ml_loc , Exn_developer , Low , None , Nocat )
| Sys_error s ->
| Sys_error s ->
let desc = Localise . verbatim_desc s in
let desc = Localise . verbatim_desc s in
( Localise . from_string " Sys_error " , desc , None , Exn_system , Low , None , Nocat )
( Localise . from_string " Sys_error " ,
| Tainted_value_reaching_sensitive_function ( desc , mloc ) ->
desc , None , Exn_system , Low , None , Nocat )
( Localise . tainted_value_reaching_sensitive_function , desc , Some mloc ,
| Tainted_value_reaching_sensitive_function ( desc , ml_loc ) ->
Exn_user , Medium , Some Kerror , Nocat )
( Localise . tainted_value_reaching_sensitive_function ,
desc , Some ml_loc , Exn_user , Medium , Some Kerror , Nocat )
| Unix . Unix_error ( _ , s1 , s2 ) ->
| Unix . Unix_error ( _ , s1 , s2 ) ->
let desc = Localise . verbatim_desc ( s1 ^ s2 ) in
let desc = Localise . verbatim_desc ( s1 ^ s2 ) in
( Localise . from_string " Unix_error " , desc , None , Exn_system , Low , None , Nocat )
( Localise . from_string " Unix_error " ,
| Uninitialized_value ( desc , mloc ) ->
desc , None , Exn_system , Low , None , Nocat )
( Localise . uninitialized_value , desc , Some mloc , Exn_user , Medium , None , Nocat )
| Uninitialized_value ( desc , ml_loc ) ->
| Unary_minus_applied_to_unsigned_expression ( desc , mloc ) ->
( Localise . uninitialized_value ,
( Localise . unary_minus_applied_to_unsigned_expression , desc , Some mloc , Exn_user , Medium , None , Nocat )
desc , Some ml_loc , Exn_user , Medium , None , Nocat )
| Unary_minus_applied_to_unsigned_expression ( desc , ml_loc ) ->
( Localise . unary_minus_applied_to_unsigned_expression ,
desc , Some ml_loc , Exn_user , Medium , None , Nocat )
| Unknown_proc ->
| Unknown_proc ->
( Localise . from_string " Unknown_proc " , Localise . no_desc , None , Exn_developer , Low , None , Nocat )
( Localise . from_string " Unknown_proc " ,
| Use_after_free ( desc , mloc ) ->
Localise . no_desc , None , Exn_developer , Low , None , Nocat )
( Localise . use_after_free , desc , Some mloc , Exn_user , High , None , Prover )
| Use_after_free ( desc , ml_loc ) ->
| Wrong_argument_number mloc ->
( Localise . use_after_free ,
( Localise . from_string " Wrong_argument_number " , Localise . no_desc , Some mloc , Exn_developer , Low , None , Nocat )
desc , Some ml_loc , Exn_user , High , None , Prover )
| Wrong_argument_number ml_loc ->
( Localise . from_string " Wrong_argument_number " ,
Localise . no_desc , Some ml_loc , Exn_developer , Low , None , Nocat )
| Failure _ as f ->
| Failure _ as f ->
raise f
raise f
| exn ->
| exn ->
let exn_name = Printexc . to_string exn in
let exn_name = Printexc . to_string exn in
( Localise . from_string exn_name , Localise . no_desc , None , Exn_developer , Low , None , Nocat ) in
( Localise . from_string exn_name ,
Localise . no_desc , None , Exn_developer , Low , None , Nocat ) in
let visibility' =
let visibility' =
if visibility = Exn_user && filter_out_bucket desc then Exn_developer else visibility in
if visibility = Exn_user && filter_out_bucket desc
( err_name , desc , mloco , visibility' , severity , force_kind , eclass )
then Exn_developer
else visibility in
( err_name , desc , ml_loc_opt , visibility' , severity , force_kind , eclass )
(* * print a description of the exception to the html output *)
(* * print a description of the exception to the html output *)
let print_exception_html s exn =
let print_exception_html s exn =
let err_name , desc , ml oco, _ , _ , _ , _ = recognize_exception exn in
let err_name , desc , ml _l oc_ opt , _ , _ , _ , _ = recognize_exception exn in
let ml oc_string = match ml oco with
let ml _l oc_string = match ml _l oc_ opt with
| None -> " "
| None -> " "
| Some ml oc -> " " ^ ml_loc ation_string m loc in
| Some ml _l oc -> " " ^ ml_loc _to_string ml_ loc in
let desc_str = pp_to_string Localise . pp_error_desc desc in
let desc_str = pp_to_string Localise . pp_error_desc desc in
( L . d_strln_color Red ) ( s ^ ( Localise . to_string err_name ) ^ " " ^ desc_str ^ ml oc_string)
( L . d_strln_color Red ) ( s ^ ( Localise . to_string err_name ) ^ " " ^ desc_str ^ ml _l oc_string)
(* * string describing an error kind *)
(* * string describing an error kind *)
let err_kind_string = function
let err_kind_string = function
@ -259,7 +324,7 @@ let err_class_string = function
let print_key = false
let print_key = false
(* * pretty print an error given its ( id,key ) , location, kind, name, description, and optional ml location *)
(* * pretty print an error given its ( id,key ) , location, kind, name, description, and optional ml location *)
let pp_err ( node_id , node_key ) loc ekind ex_name desc ml oco fmt () =
let pp_err ( node_id , node_key ) loc ekind ex_name desc ml _l oc_ opt fmt () =
let kind = err_kind_string ( if ekind = Kinfo then Kwarning else ekind ) (* eclipse does not know about infos: treat as warning *) in
let kind = err_kind_string ( if ekind = Kinfo then Kwarning else ekind ) (* eclipse does not know about infos: treat as warning *) in
let pp_key fmt k = if print_key then F . fprintf fmt " key: %d " k else () in
let pp_key fmt k = if print_key then F . fprintf fmt " key: %d " k else () in
F . fprintf fmt " %s:%d: %s: %a %a%a%a@ \n "
F . fprintf fmt " %s:%d: %s: %a %a%a%a@ \n "
@ -269,7 +334,7 @@ let pp_err (node_id, node_key) loc ekind ex_name desc mloco fmt () =
Localise . pp ex_name
Localise . pp ex_name
Localise . pp_error_desc desc
Localise . pp_error_desc desc
pp_key node_key
pp_key node_key
pp_ml_loc ation _opt ml oco
pp_ml_loc _opt ml _l oc_ opt
(* * Return true if the exception is not serious and should be handled in timeout mode *)
(* * Return true if the exception is not serious and should be handled in timeout mode *)
let handle_exception exn =
let handle_exception exn =