FaultDetection-InvalidArgumentInCall

The validity of values passed to library functions shall be checked

Required inputs: IR, StaticSemanticAnalysis

Possible Messages

Key

Text

Severity

Disabled

argument_violation

Argument not within allowed values

None

False

invalid_literal_passed

Argument not within allowed values

None

False

possible_argument_violation

Argument possibly not within allowed values

None

False

Options

argument_checks

argument_checks

Type: dict[str, dict[str, str]]

Default:

{
   'Absolute value of most negative number cannot be represented': {
      'Disallowed': 'INT_MIN',
      'Functions': 'abs',
      'Parameter': '0'
   },
   'Argument should be a lowercase letter': {
      'Allowed': '[a-z]',
      'Functions': 'toupper',
      'Parameter': '0'
   },
   'Argument should be an unsigned character': {
      'Allowed': '0-255',
      'Functions': 'iscntrl,isblank,isspace,isupper,islower,isalpha,isdigit,isxdigit,isalnum,ispunct,isgraph,isprint',
      'Parameter': '0'
   },
   'Argument should be an uppercase letter': {
      'Allowed': '[A-Z]',
      'Functions': 'tolower',
      'Parameter': '0'
   },
   'Negative numbers must not be passed to this function': {
      'Allowed': '[0.0-DBL_MAX]',
      'Functions': 'sqrt,log',
      'Parameter': '0'
   },
   'Second parameter should not be zero': {
      'Disallowed': '0.0',
      'Functions': '__math::fmod,fmod,fmodf',
      'Parameter': '1'
   }
}
Used when StaticSemanticAnalysis is used as analysis engine. Configuration of (dis)allowed values. This is a dict key -> dict with keys 'Functions', 'Parameter', and 'Allowed'/'Disallowed'. The parameter number counting starts at 0. Arguments passed in for this parameters are checked against the value specification given with '(Dis)allowed'.
 

precondition_checks

precondition_checks : set[bauhaus.analysis.config.FunctionName] = set()

When a modular semantic analysis is used as analysis engine: check preconditions of functions whose unqualified names are listed in this option. The preconditions are specified via the pre_conditions option of rules in Analysis/AnalysisControl/Environment/Externals. To create a new rule, copy Externals-FunctionSummary and adjust the functions option to match a set of functions to which the preconditions should apply. Then set pre_conditions according to the required preconditions, e.g., @param0 > 0 or @param0 == 0 || @param0 == 1.