FaultDetection-ForbiddenOperations

When allocated in specific ways, some resource operations are forbidden

Required inputs: IR, StaticSemanticAnalysis

This check detects calls to functions operating on a resource passed in as argument, where the resource was allocated in a way that forbids the call. For example, a file opened for reading should not be written into.

Possible Messages

Key

Text

Severity

Disabled

forbidden_operation

The way in which this resource was allocated forbids this operation

None

False

possibly_forbidden_operation

The way in which this resource was allocated possibly forbids this operation

None

False

Options

forbidden

forbidden

Type: dict[str, dict[str, dict[str, str | int]]]

Default:

{
   'FileHandle': {
      'Writing to a read-only file stream': {
         'Forbidden_Functions': 'fprintf',
         'Mode': 'r',
         'Mode_Parameter': 1
      }
   }
}
Dict which lists forbidden operations per resource. The mapping gives each case a description which maps to a dict for key "Forbidden_Functions", "Mode_Parameter", "Mode".
 

resources

resources : set[str] = {'FileHandle'}

Set of resources to be checked (selection of rules in the Resources group).