Miscellaneous-NoUncheckedPointerParamDereference

Check pointer parameters for NULL before dereferencing them

Required inputs: IR

To avoid undefined behavior when a NULL pointers is passed into a function, all functions should check their parameters for null pointers before dereferencing them.

Possible Messages

Key

Text

Severity

Disabled

unchecked_member_dereference

Check members of pointer type for NULL before dereferencing it.

None

False

unchecked_param_dereference

Check pointer parameter for NULL before dereferencing it.

None

False

Options

allow_non_null_comparison

allow_non_null_comparison : bool = True

Whether to allow comparisons to non-null objects (e.g., &x for a given variable x) as checks.
 

check_all_funcs

check_all_funcs : bool = False

If false, check only non-static nonmember functions and public member functions.
 

check_member_accesses

check_member_accesses : bool = False

If true, dereferences of members of pointer type will be checked as well.
 

null_check_macro

null_check_macro : bauhaus.analysis.config.MacroName = ''

Name of macro used to represent check for NULL.
 

null_check_routines

null_check_routines : set[bauhaus.analysis.config.QualifiedName] = set()

Qualified names of functions used to realize a null check.
 

types_ignored_by_qualified_name

types_ignored_by_qualified_name : set[bauhaus.analysis.config.QualifiedName] = set()

Types of parameters to be ignored by the check, i.e., types that cannot be null.