Title: CC. Undefined Behavior  
Author: Martin Sebor Jan 06, 2010
Last Changed by: Caden Milne Nov 25, 2024
Tiny Link: (useful for email) https://wiki.sei.cmu.edu/confluence/x/mNYxBQ
Export As: Word · PDF  
Incoming Links
SEI CERT C Coding Standard (47)
    Page: MSC37-C. Ensure that control never reaches the end of a non-void function
    Page: EXP32-C. Do not access a volatile object through a nonvolatile reference
    Page: EXP36-C. Do not cast pointers into more strictly aligned pointer types
    Page: ARR36-C. Do not subtract or compare two pointers that do not refer to the same array
    Page: SIG31-C. Do not access shared objects in signal handlers
    Page: SIG35-C. Do not return from a computational exception signal handler
    Page: ARR38-C. Guarantee that library functions do not form invalid pointers
    Page: DCL36-C. Do not declare an identifier with conflicting linkage classifications
    Page: STR37-C. Arguments to character-handling functions must be representable as an unsigned char
    Page: DCL30-C. Declare objects with appropriate storage durations
    Page: STR30-C. Do not attempt to modify string literals
    Page: EXP43-C. Avoid undefined behavior when using restrict-qualified pointers
    Page: PRE32-C. Do not use preprocessor directives in invocations of function-like macros
    Page: DCL10-C. Maintain the contract between the writer and caller of variadic functions
    Page: PRE30-C. Do not create a universal character name through concatenation
    Page: INT33-C. Ensure that division and remainder operations do not result in divide-by-zero errors
    Page: INT34-C. Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand
    Page: MSC15-C. Do not depend on undefined behavior
    Page: INT36-C. Converting a pointer to integer or integer to pointer
    Page: MSC38-C. Do not treat a predefined identifier as an object if it might only be implemented as a macro
    Page: ERR07-C. Prefer functions that support error checking over equivalent functions that don't
    Page: ERR32-C. Do not rely on indeterminate values of errno
    Page: FIO46-C. Do not access a closed file
    Page: MSC14-C. Do not introduce unnecessary platform dependencies
    Page: MSC22-C. Use the setjmp(), longjmp() facility securely
    Page: ARR32-C. Ensure size arguments for variable length arrays are in a valid range
    Page: EXP37-C. Call functions with the correct number and type of arguments
    Page: FIO47-C. Use valid format strings
    Page: EXP05-C. Do not cast away a const qualification
    Page: DCL23-C. Guarantee that mutually visible identifiers are unique
    Page: DCL21-C. Understand the storage of compound literals
    Page: ARR30-C. Do not form or use out-of-bounds pointers or array subscripts
    Page: EXP40-C. Do not modify constant objects
    Page: FIO22-C. Close files before spawning processes
    Page: FLP34-C. Ensure that floating-point conversions are within range of the new type
    Page: ENV30-C. Do not modify the object referenced by the return value of certain functions
    Page: FIO39-C. Do not alternately input and output from a stream without an intervening flush or positioning call
    Page: EXP33-C. Do not read uninitialized memory
    Page: MEM34-C. Only free memory allocated dynamically
    Page: DCL37-C. Do not declare or define a reserved identifier
    Page: DCL40-C. Do not create incompatible declarations of the same function or object
    Page: FIO40-C. Reset strings on fgets() or fgetws() failure
    Page: EXP30-C. Do not depend on the order of evaluation for side effects
    Page: CON37-C. Do not call signal() in a multithreaded program
    Page: SIG30-C. Call only asynchronous-safe functions within signal handlers
    Page: ERR04-C. Choose an appropriate termination strategy
    Page: EXP39-C. Do not access a variable through a pointer of an incompatible type
Hierarchy
Parent Page
    Page: 4 Back Matter
Labels
Global Labels (2)
Time Editor  
Nov 25, 2024 10:57 Caden Milne View Changes
Updated Rule 65 link to referenced rule
Nov 25, 2024 09:10 Caden Milne View Changes
Finished: Updated references from C11->C23
Nov 22, 2024 10:42 Caden Milne View Changes
Updated references from C11->C23 for UBs 52-122
Nov 22, 2024 09:04 Caden Milne View Changes
Nov 29, 2023 08:33 David Svoboda  
Outgoing Links
External Links (3)
    https://www.securecoding.cert.org/confluence/display/seccod…
    https://www.securecoding.cert.org/confluence/display/seccod…
    https://www.securecoding.cert.org/confluence/display/seccod…
SEI CERT C Coding Standard (53)     Page: ERR07-C. Prefer functions that support error checking over equivalent functions that don't
    Page: STR30-C. Do not attempt to modify string literals
    Page: CON37-C. Do not call signal() in a multithreaded program
    Page: ARR38-C. Guarantee that library functions do not form invalid pointers
    Page: AA. Bibliography
    Page: EXP34-C. Do not dereference null pointers
    Page: MEM31-C. Free dynamically allocated memory when no longer needed
    Page: ARR36-C. Do not subtract or compare two pointers that do not refer to the same array
    Page: EXP36-C. Do not cast pointers into more strictly aligned pointer types
    Page: FIO40-C. Reset strings on fgets() or fgetws() failure
    Page: PRE30-C. Do not create a universal character name through concatenation
    Page: MSC22-C. Use the setjmp(), longjmp() facility securely
    Page: EXP40-C. Do not modify constant objects
    Home page: SEI CERT C Coding Standard
    Page: STR37-C. Arguments to character-handling functions must be representable as an unsigned char
    Page: SIG31-C. Do not access shared objects in signal handlers
    Page: FIO39-C. Do not alternately input and output from a stream without an intervening flush or positioning call
    Page: PRE32-C. Do not use preprocessor directives in invocations of function-like macros
    Page: DCL40-C. Do not create incompatible declarations of the same function or object
    Page: MSC38-C. Do not treat a predefined identifier as an object if it might only be implemented as a macro
    Page: DCL36-C. Do not declare an identifier with conflicting linkage classifications
    Page: EXP05-C. Do not cast away a const qualification
    Page: MSC15-C. Do not depend on undefined behavior
    Page: EXP30-C. Do not depend on the order of evaluation for side effects
    Page: DCL37-C. Do not declare or define a reserved identifier
    Page: INT34-C. Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand
    Page: INT32-C. Ensure that operations on signed integers do not result in overflow
    Page: DCL23-C. Guarantee that mutually visible identifiers are unique
    Page: EXP32-C. Do not access a volatile object through a nonvolatile reference
    Page: ENV30-C. Do not modify the object referenced by the return value of certain functions
    Page: EXP43-C. Avoid undefined behavior when using restrict-qualified pointers
    Page: ARR30-C. Do not form or use out-of-bounds pointers or array subscripts
    Page: BB. Definitions
    Page: DCL31-C. Declare identifiers before using them
    Page: MSC37-C. Ensure that control never reaches the end of a non-void function
    Page: FIO47-C. Use valid format strings
    Page: SIG30-C. Call only asynchronous-safe functions within signal handlers
    Page: INT33-C. Ensure that division and remainder operations do not result in divide-by-zero errors
    Page: EXP37-C. Call functions with the correct number and type of arguments
    Page: SIG35-C. Do not return from a computational exception signal handler
    Page: INT36-C. Converting a pointer to integer or integer to pointer
    Page: FIO46-C. Do not access a closed file
    Page: DCL21-C. Understand the storage of compound literals
    Page: FLP34-C. Ensure that floating-point conversions are within range of the new type
    Page: ERR04-C. Choose an appropriate termination strategy
    Page: EXP39-C. Do not access a variable through a pointer of an incompatible type
    Page: MEM30-C. Do not access freed memory
    Page: ARR32-C. Ensure size arguments for variable length arrays are in a valid range
    Page: EXP33-C. Do not read uninitialized memory
    Page: MEM04-C. Beware of zero-length allocations
    Page: ENV32-C. All exit handlers must return normally
    Page: ERR32-C. Do not rely on indeterminate values of errno
    Page: DCL30-C. Declare objects with appropriate storage durations