Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Generated Content
Info
title
Note

This page is automatically generated from the "Automated Detection" sections in the individual guidelines. Do not modify this page directly.

Version number:

was automatically generated and should not be edited.

Note

The information on this page was provided by outside contributors and has not been verified by SEI CERT.

Tip

The table below can be re-ordered, by clicking column headers.

...

Include Page
CodeSonar_V
CodeSonar_V

Checker

Guideline

ALLOC.DF MEM51-CPP. Properly deallocate dynamically allocated resources
ALLOC.DF OOP54-CPP. Gracefully handle self-copy assignment
ALLOC.FNH MEM51-CPP. Properly deallocate dynamically allocated resources
ALLOC.LEAK

Checker

Guideline

(custom)CON00-CPP. Avoid assuming functions are thread safe unless otherwise specified
(customization)FIO06-CPP. Create files with appropriate access permissions
(customization)INT06-CPP. Use strtol() or a related function to convert a string token to an integer
(general)INT04-CPP. Enforce limits on integer values originating from untrusted sources
ALLOC.DFMEM11-CPP. Allocate and free memory in the same module, at the same level of abstraction
ALLOC.FNH MEM51-CPP. Properly deallocate dynamically allocated resources
ALLOC.LEAK FIO51-CPP. Close files when they are no longer needed
ALLOC.LEAK ERR56-CPP. Guarantee exception safety
ALLOC.LEAK ERR57-CPP. Do not leak resources when handling exceptions
ALLOC.LEAK MEM11 OOP54-CPP. Allocate and free memory in the same module, at the same level of abstractionGracefully handle self-copy assignment
ALLOC.LEAKTM MEM12 EXP51-CPP. Do not assume infinite heap spacedelete an array through a pointer of the incorrect type
ALLOC.SIZE.ADDOFLOWTM INT08 MEM51-CPP. Verify that all integer values are in rangeProperly deallocate dynamically allocated resources
ALLOC.SIZE.ADDOFLOWUAF INT18 EXP54-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that sizeDo not access an object outside of its lifetime
ALLOC.SIZE.IOFLOWUAF INT08 CTR51-CPP. Verify that all integer values are in range
ALLOC.SIZE.IOFLOWINT18-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size
ALLOC.SIZE.MULOFLOWINT08-CPP. Verify that all integer values are in range
ALLOC.SIZE.MULOFLOWINT18-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size
ALLOC.SIZE.MULOFLOWMEM07-CPP. Ensure that the arguments to calloc(), when multiplied, can be represented as a size_t
ALLOC.SIZE.SUBUFLOWINT08-CPP. Verify that all integer values are in range
ALLOC.SIZE.SUBUFLOWINT18-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size
ALLOC.SIZE.TRUNCINT02-CPP. Understand integer conversion rules
ALLOC.SIZE.TRUNCINT18-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size
ALLOC.TMMEM51-CPP. Properly deallocate dynamically allocated resources
ALLOC.UAFEXP54-CPP. Do not access an object outside of its lifetime
ALLOC.UAFMEM50-CPP. Do not access freed memory
BADFUNC.ATOFINT06-CPP. Use strtol() or a related function to convert a string token to an integer
BADFUNC.ATOIINT06-CPP. Use strtol() or a related function to convert a string token to an integer
BADFUNC.ATOLINT06-CPP. Use strtol() or a related function to convert a string token to an integer
Use valid references, pointers, and iterators to reference elements of a container
ALLOC.UAF STR52-CPP. Use valid references, pointers, and iterators to reference elements of a basic_string
ALLOC.UAF MEM50-CPP. Do not access freed memory
ALLOC.UAF OOP54-CPP. Gracefully handle self-copy assignment
BADFUNC.ABORT ERR50-CPP. Do not abruptly terminate the program
BADFUNC.ATOF ERR62-CPP. Detect errors when converting a string to a number
BADFUNC.ATOI ERR62-CPP. Detect errors when converting a string to a number
BADFUNC.ATOL ERR62-CPP. Detect errors when converting a string to a number
BADFUNC.ATOLL ERR62-CPP. Detect errors when converting a string to a number
BADFUNC.BO.* CTR52-CPP. Guarantee that library functions do not overflow
BADFUNC.EXIT ERR50-CPP. Do not abruptly terminate the program BADFUNC.ATOLLINT06-CPP. Use strtol() or a related function to convert a string token to an integer
BADFUNC.LONGJMP ERR52-CPP. Do not use setjmp() or longjmp()
BADFUNC.MEMSETMEMCMP MSC06 EXP62-CPP. Be aware of compiler optimization when dealing with sensitive dataDo not access the bits of an object representation that are not part of the object's value representation
BADFUNC.MEMCMP OOP57-CPP. Prefer special member functions and overloaded operators to C Standard Library functions
BADFUNC.MEMSET EXP62-CPP. Do not access the bits of an object representation that are not part of the object's value representation
BADFUNC.MEMSET OOP57-CPP. Prefer special member functions and overloaded operators to C Standard Library functions BADFUNC.PATH.SYSTEMENV02-CPP. Do not call system() if you do not need a command processor
BADFUNC.RANDOM.RAND MSC50-CPP. Do not use std::rand() for generating pseudorandom numbers
BADFUNC.RANDOM.RANDCON00-CPP. Avoid assuming functions are thread safe unless otherwise specifiedBADFUNC.SETJMP ERR52-CPP. Do not use setjmp() or longjmp()
BADFUNC BADMACRO.SIGNALOFFSETOF SIG02 EXP59-CPP. Avoid using signals to implement normal functionalityUse offsetof() on valid types and members
BADMACRO.STDARGBADFUNC.STDIO_H FIO17 EXP58-CPP. Prefer streams to C-style input and output
BADFUNC.TEMP.*FIO01-CPP. Be careful using functions that use file names for identification
BADFUNC.TEMP.*FIO19-CPP. Do not create temporary files in shared directories
BADFUNC.TTYNAMECON00-CPP. Avoid assuming functions are thread safe unless otherwise specified
BADFUNC.WCHAR_HFIO17-CPP. Prefer streams to C-style input and output
BUILD.WALLMSC00-CPP. Compile cleanly at high warning levels
Pass an object of the correct type to va_start
CONCURRENCY.BADFUNC.CNDSIGNAL CON55-CPP. Preserve thread safety and liveness when using condition variables
CONCURRENCY.BADFUNC.CNDWAIT CON54-CPP. Wrap functions that can spuriously wake up in a loop
CONCURRENCY.DATARACE CON52-CPP. Prevent data races when accessing bit-fields from multiple threads
CONCURRENCY.LOCALARG CON50-CPP. Do not destroy a mutex while it is locked
CONCURRENCY.LOCK.NOUNLOCK CON51-CPP. Ensure actively held locks are released on exceptional conditions CONCURRENCY.DATARACECON00-CPP. Avoid assuming functions are thread safe unless otherwise specified
CONCURRENCY.LOCK.ORDER CON53-CPP. Avoid deadlock by locking in a predefined order
IO CONCURRENCY.INJ.COMMANDTL STR02 CON56-CPP. Sanitize data passed to complex subsystems
IO.INJ.FMTFIO00-CPP. Take care when creating format strings
IO.INJ.FMTSTR02-CPP. Sanitize data passed to complex subsystems
IO.INJ.LDAPSTR02-CPP. Sanitize data passed to complex subsystems
IO.INJ.LIBSTR02-CPP. Sanitize data passed to complex subsystems
IO.INJ.SQLSTR02-CPP. Sanitize data passed to complex subsystems
IO.RACEFIO01-CPP. Be careful using functions that use file names for identification
IO.TAINT.ADDRINT04-CPP. Enforce limits on integer values originating from untrusted sources
IO.TAINT.FNAMEFIO01-CPP. Be careful using functions that use file names for identification
IO.TAINT.FNAMEFIO02-CPP. Canonicalize path names originating from untrusted sources
Do not speculatively lock a non-recursive mutex that is already owned by the calling thread
HARDCODED.SEED MSC51-CPP. Ensure your random number generator is properly seeded
IO.DC OOP54-CPP. Gracefully handle self-copy assignment
IO.IOWOP FIO50-CPP. Do not alternately input and output from a file stream without an intervening positioning call
IO.OIWOP FIO50-CPP. Do not alternately input and output from a file stream without an intervening positioning call IO.TAINT.SIZEINT04-CPP. Enforce limits on integer values originating from untrusted sources
IO.UAC EXP54-CPP. Do not access an object outside of its lifetime
LANG IO.CAST.COERCEUAC INT02 OOP54-CPP. Understand integer conversion rulesGracefully handle self-copy assignment
LANG.CAST.COERCE INT18 INT50-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that sizeLANG.CAST.PC.AVEXP16-CPP. Avoid conversions using void pointersDo not cast to an out-of-range enumeration value
LANG.CAST.PC.AVOBJSLICE INT11 OOP51-CPP. Take care when converting from pointer to integer or integer to pointerDo not slice derived objects
LANG.CAST.PC.INC EXP57-CPP. Do not cast or delete pointers to incomplete classes
LANG.CAST.PC.INTVALUE INT11 INT50-CPP. Take care when converting from pointer to integer or integer to pointer
LANG.CAST.PC.PVEXP16-CPP. Avoid conversions using void pointers
LANG.CAST.RIPEXP15-CPP. Beware of integer promotion when performing bitwise operations on chars or shorts
LANG.CAST.VALUEINT02-CPP. Understand integer conversion rules
LANG.CAST.VALUEINT18-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size
LANG.FUNCS.IRVERR10-CPP. Check for error conditions
LANG.FUNCS.IRVEXP12-CPP. Do not ignore values returned by functions or methods
LANG.FUNCS.IRVFIO04-CPP. Detect and handle input and output errors
LANG.ID.AMBIGDCL02-CPP. Use visually distinct identifiers
LANG.ID.ND.NESTDCL01-CPP. Do not reuse variable names in subscopes
Do not cast to an out-of-range enumeration value
LANG.FUNCS.COPINC OOP58-CPP. Copy operations must not mutate the source object
LANG.ID.LANG.ID.NU.MK DCL51-CPP. Do not declare or define a reserved identifier
LANG.MEM.BO CTR50-CPP. Guarantee that container indices and iterators are within the valid range
LANG.MEM.BO CTR52-CPP. Guarantee that library functions do not overflow
LANG.MEM.BO CTR53-CPP. Use valid iterator ranges
LANG.MEM.BO STR50-CPP. Guarantee that storage for strings has sufficient space for character data and the null terminator
LANG.MEM.BO STR53-CPP. Range check element access
LANG.MEM.BO MEM54-CPP. Provide placement new with properly aligned pointers to sufficient storage capacity
LANG.MEM.BU CTR50-CPP. Guarantee that container indices and iterators are within the valid range
LANG.MEM.BU STR53-CPP. Range check element access
LANG.MEM.NPD EXP63-CPP. Do not rely on the value of a moved-from object
LANG.MEM.NPD STR51-CPP. Do not attempt to create a std::string from a null pointer
LANG.MEM.NPD OOP54-CPP. Gracefully handle self-copy assignment
LANG.MEM.TBA CTR50-CPP. Guarantee that container indices and iterators are within the valid range
LANG.MEM.TBA STR53 CTR52-CPP. Range check element accessGuarantee that library functions do not overflow
LANG.MEM.TBA INT04 STR53-CPP. Enforce limits on integer values originating from untrusted sourcesRange check element access
LANG.MEM.TO CTR50-CPP. Guarantee that container indices and iterators are within the valid range
LANG.MEM.TO STR50-CPP. Guarantee that storage for strings has sufficient space for character data and the null terminator
LANG.MEM.TO STR53-CPP. Range check element access
LANG.MEM.TU CTR50-CPP. Guarantee that container indices and iterators are within the valid range
LANG.MEM.TU STR53-CPP. Range check element access
LANG.MEM.UVAR EXP53-CPP. Do not read uninitialized memory
LANG.MEM.UVAR MEM09 EXP63-CPP. Do not assume memory allocation routines initialize memoryLANG.PREPROC.MACROENDPRE02-CPP. Macro replacement lists should be parenthesizedrely on the value of a moved-from object
LANG.PREPROCMEM.MACROENDUVAR PRE11 OOP55-CPP. Do not conclude macro definitions with a semicolonLANG.PREPROC.MACROSTARTPRE02-CPP. Macro replacement lists should be parenthesizeduse pointer-to-member operators to access nonexistent members
LANG.PREPROCSTRUCT.PASTECUP PRE05 CTR54-CPP. Understand macro replacement when concatenating tokens or performing stringificationDo not subtract iterators that do not refer to the same container
LANG.STRUCT.DECL.CONDASSIGANH EXP19 DCL59-CPP. Do not perform assignments in conditional expressionsdefine an unnamed namespace in a header file
LANG.STRUCT.CONDASSIGDECL.FNEST MSC02 DCL53-CPP. Avoid errors of omissionDo not write syntactically ambiguous declarations
LANG.STRUCT.DECL.FAMRESERVED CTR02 DCL51-CPP. Explicitly specify array bounds, even if implicitly defined by an initializerDo not declare or define a reserved identifier
LANG.STRUCT.DECL.MLSNM DCL04 DCL58-CPP. Do not declare more than one variable per declarationmodify the standard namespaces
LANG.STRUCT.DEF.FDH MSC52 DCL60-CPP. Obey the one-definition rule
LANG.STRUCT.DEF.ODH MSC52 DCL60-CPP. Obey the one-definition rule
LANG.STRUCT.EBSDNVD MSC12 OOP52-CPP. Detect and remove code that has no effectDo not delete a polymorphic object without a virtual destructor
LANG.STRUCT.INIT.ENUMELLIPSIS INT09 DCL50-CPP. Ensure enumeration constants map to unique valuesDo not define a C-style variadic function
LANG.STRUCT.MRSEXCP.CATCH MSC54 DCL57-CPP. Value-returning functions must return a value from all exit pathsDo not let exceptions escape from destructors or deallocation functions
LANG.STRUCT.PBBCTR50-CPP. Guarantee that container indices and iterators are within the valid rangeLANG.STRUCT.PPEEXCP.CATCH ERR61-CPP. Catch exceptions by lvalue reference CTR50-CPP. Guarantee that container indices and iterators are within the valid range
LANG.STRUCT.RCMSC02-CPP. Avoid errors of omissionEXCP.THROW DCL57-CPP. Do not let exceptions escape from destructors or deallocation functions LANG.STRUCT.RCMSC03-CPP. Avoid errors of addition
LANG.STRUCT.RCMSC07-CPP. Detect and remove dead codeEXCP.THROW ERR55-CPP. Honor exception specifications LANG.STRUCT.RCMSC12-CPP. Detect and remove code that has no effect
LANG.STRUCT.RPLEXP53-CPP. Do not read uninitialized memoryEXCP.THROW ERR58-CPP. Handle all exceptions thrown before main() begins executing LANG.STRUCT.SCOPE.FILEDCL07-CPP. Minimize the scope of variables and methods
LANG.STRUCT.SCOPEEXCP.LOCALTHROW DCL07 ERR61-CPP. Minimize the scope of variables and methodsCatch exceptions by lvalue reference
LANG.STRUCT.SE.CONDICOL EXP19 CON54-CPP. Do not perform assignments in conditional expressionsWrap functions that can spuriously wake up in a loop
LANG.STRUCT.SWINIT.MBCYCLE MSC02 DCL56-CPP. Avoid errors of omissioncycles during initialization of static objects
LANG.STRUCT.SWINIT.MBOOMI MSC18 OOP53-CPP. Finish every set of statements associated with a case label with a break statementWrite constructor member initializers in the canonical order
LANG.STRUCT.UAMSC12-CPP. Detect and remove code that has no effectINIT.UNORDERED DCL56LANG.STRUCT.UCMSC02-CPP. Avoid errors of omissioncycles during initialization of static objects
LANG.STRUCT.UCMRS MSC03 MSC52-CPP. Avoid errors of additionValue-returning functions must return a value from all exit paths
LANG.STRUCT.UCNVNR MSC07 MSC52-CPP. Detect and remove dead codeValue-returning functions must return a value from all exit paths
LANG.STRUCT.UCPARITH MSC12 CTR50-CPP. Detect and remove code that has no effectGuarantee that container indices and iterators are within the valid range
LANG.STRUCT.UPDPARITH MSC08 CTR56-CPP. Functions should validate their parametersDo not use pointer arithmetic on polymorphic objects
LANG.STRUCT.UULABELPBB MSC12 CTR50-CPP. Detect and remove code that has no effectGuarantee that container indices and iterators are within the valid range
LANG.STRUCT.UUMACROPPE MSC12 CTR50-CPP. Detect and remove code that has no effectGuarantee that container indices and iterators are within the valid range
LANG.STRUCT.UUPARAMRC MSC12 OOP54-CPP. Detect and remove code that has no effectLANG.STRUCT.UUTAGMSC12-CPP. Detect and remove code that has no effectGracefully handle self-copy assignment
LANG.STRUCT.UUTYPERFNR MSC12 MSC53-CPP. Detect and remove code that has no effectDo not return from a function declared [[noreturn]]
LANG.STRUCT.UUVALRPL MSC13 EXP53-CPP. Detect and remove unused valuesDo not read uninitialized memory
LANG.STRUCT.UUVARMSC12-CPP. Detect and remove code that has no effect
LANG.TYPE.AWIDINT18-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size
LANG.TYPE.BASICINT01-CPP. Use rsize_t or size_t for all integer values representing the size of an object
SE.DEC EXP50-CPP. Do not depend on the order of evaluation for side effects
LANG.STRUCT.SE.INC EXP50LANG.TYPE.BFSIGNINT12-CPP. Do not make assumptions about the type of a plain int bit-field when used in an expression
LANG.TYPE.CSUFDCL16-CPP. Use "L," not "l," to indicate a long value
LANG.TYPE.IATSTR04-CPP. Use plain char for characters in the basic character set
LANG.TYPE.ICTSTR04-CPP. Use plain char for characters in the basic character set
LANG.TYPE.IOTINT07-CPP. Use only explicitly signed or unsigned char type for numeric values
LANG.TYPE.IOTINT13-CPP. Use bitwise operators only on unsigned operands
LANG.TYPE.IOTSTR04-CPP. Use plain char for characters in the basic character set
LANG.TYPE.MOTFLP05-CPP. Convert integers to floating point for floating point operations
LANG.TYPE.MOTSTR04-CPP. Use plain char for characters in the basic character set
LANG.TYPE.NCSSTR05-CPP. Use pointers to const when referring to string literals
LANG.TYPE.OWIDINT18-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size
depend on the order of evaluation for side effects
LANG.STRUCT.SE.SIZEOF EXP52-CPP. Do not rely on side effects in unevaluated operands
LANG.STRUCT.SUP CTR54-CPP. Do not subtract iterators that do not refer to the same container
LANG.STRUCT.UCTCH ERR51-CPP. Handle all exceptions
LANG.STRUCT.UCTCH ERR54-CPP. Catch handlers should order their parameter types from most derived to least derived
LANG.STRUCT.VCALL_IN_CTOR OOP50-CPP. Do not invoke virtual functions from constructors or destructors
LANG.STRUCT.VCALL_IN_DTOR OOP50-CPP. Do not invoke virtual functions from constructors or destructors
MISC.CRYPTO.TIMESEED MSC51-CPP. Ensure your random number generator is properly seeded MISC.FMTFIO00-CPP. Take care when creating format strings
MISC.MEM.NTERM STR50-CPP. Guarantee that storage for strings has sufficient space for character data and the null terminator
MISC.MEMPADDING.NTERMPOTB STR03 DCL55-CPP. Do not inadvertently truncate a null-terminated character array
MISC.MEM.SIZE.ADDOFLOWINT08-CPP. Verify that all integer values are in range
MISC.MEM.SIZE.ADDOFLOWINT18-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size
MISC.MEM.SIZE.BADINT08-CPP. Verify that all integer values are in range
MISC.MEM.SIZE.BADINT18-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size
MISC.MEM.SIZE.MULOFLOWINT08-CPP. Verify that all integer values are in range
MISC.MEM.SIZE.MULOFLOWINT18-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size
MISC.MEM.SIZE.SUBUFLOWINT08-CPP. Verify that all integer values are in range
MISC.MEM.SIZE.SUBUFLOWINT18-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size
MISC.MEM.SIZE.TRUNCINT02-CPP. Understand integer conversion rules
MISC.MEM.SIZE.TRUNCINT18-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size
MISC.NEGCHARINT05-CPP. Do not use input functions to convert character data if they cannot handle all possible inputs
MISC.NEGCHARSTR00-CPP. Represent characters using an appropriate type
MISC.NOEFFECTMSC12-CPP. Detect and remove code that has no effect

...