メインコンテンツ

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

CERT C++ ルール

Polyspace® でサポートされている CERT C++ 標準ルールのリストと説明

CERT C++ はソフトウェア開発者向けの一連のコード ガイドラインです。C++ 言語での安全なコーディングを中心としています。このガイドラインは、実行時に予期しない結果を招き、セキュリティの脆弱性が外部にさらされる可能性のある未定義の動作を含む構文を取り除くのに役立ちます。CERT C++ ルールに対する Polyspace の対応範囲を確認するには、Polyspace でのコーディング規約のサポートを参照してください。Polyspace では、CERT C++ 標準に対してコードをチェックできます。[SEI CERT-C++ をチェック] (-cert-cpp) 解析オプションを使用して、このルールのサブセットを有効にします。

Polyspace 結果

すべて展開する

CERT C++: DCL30-CDeclare objects with appropriate storage durations
CERT C++: DCL39-CAvoid information leakage in structure padding
CERT C++: DCL40-CDo not create incompatible declarations of the same function or object
CERT C++: DCL50-CPPDo not define a C-style variadic function
CERT C++: DCL51-CPP予約済みの識別子を宣言または定義しない
CERT C++: DCL52-CPPconst または volatile で参照型を修飾しない
CERT C++: DCL53-CPP構文的にあいまいな宣言を記述しない
CERT C++: DCL54-CPP割り当て関数と割り当て解除関数を同じスコープ内でペアとしてオーバーロード
CERT C++:DCL55-CPPAvoid information leakage when passing a class object across a trust boundary (R2022b 以降)
CERT C++:DCL56-CPPAvoid cycles during initialization of static objects (R2022b 以降)
CERT C++:DCL57-CPPDo not let exceptions escape from destructors or deallocation functions
CERT C++: DCL58-CPP標準の名前空間を変更しない
CERT C++:DCL59-CPPDo not define an unnamed namespace in a header file
CERT C++: DCL60-CPPObey the one-definition rule
CERT C++: EXP34-CDo not dereference null pointers
CERT C++: EXP35-C有効期間が一時的なオブジェクトを変更しない
CERT C++: EXP36-CDo not cast pointers into more strictly aligned pointer types
CERT C++: EXP37-CCall functions with the correct number and type of arguments
CERT C++: EXP39-CDo not access a variable through a pointer of an incompatible type
CERT C++: EXP42-Cパディング データを比較しない
CERT C++: EXP45-CDo not perform assignments in selection statements
CERT C++: EXP46-Cboolean 形式のオペランドと一緒にビット演算子を使用しない
CERT C++: EXP47-C無効な型の引数を使用して va_arg を呼び出さない
CERT C++: EXP50-CPP二次的影響に関して評価の順序に依存しない
CERT C++:EXP51-CPPDo not delete an array through a pointer of the incorrect type (R2022b 以降)
CERT C++:EXP52-CPPDo not rely on side effects in unevaluated operands
CERT C++: EXP53-CPPDo not read uninitialized memory
CERT C++: EXP54-CPPDo not access an object outside of its lifetime
CERT C++: EXP55-CPPDo not access a cv-qualified object through a cv-unqualified type
CERT C++:EXP56-CPPDo not call a function with a mismatched language linkage (R2023b 以降)
CERT C++:EXP57-CPPDo not cast or delete pointers to incomplete classes
CERT C++: EXP58-CPP適切な型のオブジェクトを va_start に渡す
CERT C++: EXP59-CPP有効な型およびメンバーに対して offsetof() を使用する
CERT C++:EXP60-CPPDo not pass a nonstandard-layout type object across execution boundaries (R2023b 以降)
CERT C++:EXP61-CPPA lambda object must not outlive any of its reference captured objects
CERT C++:EXP62-CPPDo not access the bits of an object representation that are not part of the object's value representation (R2022b 以降)
CERT C++:EXP63-CPPDo not rely on the value of a moved-from object (R2021a 以降)
CERT C++: INT30-CEnsure that unsigned integer operations do not wrap
CERT C++: INT31-CEnsure that integer conversions do not result in lost or misinterpreted data
CERT C++: INT32-CEnsure that operations on signed integers do not result in overflow
CERT C++: INT33-CEnsure that division and remainder operations do not result in divide-by-zero errors
CERT C++: INT34-CDo 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
CERT C++: INT35-CUse correct integer precisions
CERT C++: INT36-CConverting a pointer to integer or integer to pointer
CERT C++:INT50-CPPDo not cast to an out-of-range enumeration value (R2023b 以降)
CERT C++: ARR30-CDo not form or use out-of-bounds pointers or array subscripts
CERT C++: ARR37-CDo not add or subtract an integer to a pointer to a non-array object
CERT C++: ARR38-CGuarantee that library functions do not form invalid pointers
CERT C++: ARR39-CDo not add or subtract a scaled integer to a pointer
CERT C++: CTR50-CPPGuarantee that container indices and iterators are within the valid range
CERT C++:CTR51-CPPUse valid references, pointers, and iterators to reference elements of a container (R2022a 以降)
CERT C++:CTR52-CPPGuarantee that library functions do not overflow (R2022b 以降)
CERT C++:CTR53-CPPUse valid iterator ranges (R2022b 以降)
CERT C++:CTR54-CPPDo not subtract iterators that do not refer to the same container (R2022b 以降)
CERT C++:CTR55-CPPDo not use an additive operator on an iterator if the result would overflow (R2022b 以降)
CERT C++:CTR56-CPPDo not use pointer arithmetic on polymorphic objects (R2023a 以降)
CERT C++:CTR57-CPPProvide a valid ordering predicate (R2022a 以降)
CERT C++:CTR58-CPPPredicate function objects should not be mutable (R2022a 以降)
CERT C++: STR30-CDo not attempt to modify string literals
CERT C++: STR31-CGuarantee that storage for strings has sufficient space for character data and the null terminator
CERT C++: STR32-CDo not pass a non-null-terminated character sequence to a library function that expects a string
CERT C++: STR34-CCast characters to unsigned char before converting to larger integer sizes
CERT C++: STR37-C文字処理関数の引数は符号なし char で表現できなければならない
CERT C++: STR38-Cナロー文字列およびワイド文字列と関数を混同しない
CERT C++: STR50-CPPGuarantee that storage for strings has sufficient space for character data and the null terminator
CERT C++:STR51-CPPDo not attempt to create a std::string from a null pointer (R2022b 以降)
CERT C++:STR52-CPPUse valid references, pointers, and iterators to reference elements of a basic_string (R2022b 以降)
CERT C++:STR53-CPPRange check element access
CERT C++: MEM30-CDo not access freed memory
CERT C++: MEM31-CFree dynamically allocated memory when no longer needed
CERT C++: MEM34-COnly free memory allocated dynamically
CERT C++: MEM35-CAllocate sufficient memory for an object
CERT C++: MEM36-Crealloc() を呼び出してオブジェクトのアライメントを変更しない
CERT C++: MEM50-CPPDo not access freed memory
CERT C++: MEM51-CPPProperly deallocate dynamically allocated resources
CERT C++: MEM52-CPPDetect and handle memory allocation errors
CERT C++:MEM53-CPPExplicitly construct and destruct objects when manually managing object lifetime (R2022b 以降)
CERT C++:MEM54-CPPProvide placement new with properly aligned pointers to sufficient storage capacity
CERT C++:MEM55-CPPHonor replacement dynamic storage management requirements
CERT C++:MEM56-CPPDo not store an already-owned pointer value in an unrelated smart pointer (R2021a 以降)
CERT C++:MEM57-CPPAvoid using default operator new for over-aligned types
CERT C++: FIO30-CExclude user input from format strings
CERT C++: FIO32-CDo not perform operations on devices that are only appropriate for files
CERT C++: FIO34-CDistinguish between characters read from a file and EOF or WEOF
CERT C++: FIO37-CDo not assume that fgets() or fgetws() returns a nonempty string when successful
CERT C++: FIO38-CFILE オブジェクトをコピーしない
CERT C++: FIO39-Cフラッシュまたは位置付け呼び出しの介在なしでのストリームからの入出力を交互実行しない
CERT C++: FIO40-Cfgets() または fgetws() 失敗時に文字列をリセットする
CERT C++: FIO41-C二次的影響があるストリーム引数を使用して getc()、putc()、getwc()、putwc() を呼び出さない
CERT C++: FIO42-CClose files when they are no longer needed
CERT C++: FIO44-Cfgetpos() から返された fsetpos() の値のみを使用する
CERT C++: FIO45-CAvoid TOCTOU race conditions while accessing files
CERT C++: FIO46-CDo not access a closed file
CERT C++: FIO47-CUse valid format strings
CERT C++: FIO50-CPP位置付け呼び出しの介在なしでのファイル ストリームからの入出力を交互実行しない
CERT C++: FIO51-CPPClose files when they are no longer needed
CERT C++: ERR30-CSet errno to zero before calling a library function known to set errno, and check errno only after the function returns a value indicating failure
CERT C++: ERR32-Cerrno の不確定の値に依存しない
CERT C++: ERR33-C標準ライブラリのエラーを検出および処理する
CERT C++: ERR34-C文字列を数値に変換する際にエラーを検出する
CERT C++: ERR50-CPPDo not abruptly terminate the program
CERT C++: ERR51-CPPHandle all exceptions
CERT C++: ERR52-CPPDo not use setjmp() or longjmp()
CERT C++: ERR53-CPPDo not reference base classes or class data members in a constructor or destructor function-try-block handler
CERT C++: ERR54-CPPCatch handlers should order their parameter types from most derived to least derived
CERT C++: ERR55-CPPHonor exception specifications
CERT C++:ERR56-CPPGuarantee exception safety (R2022a 以降)
CERT C++:ERR57-CPPDo not leak resources when handling exceptions (R2021a 以降)
CERT C++:ERR58-CPPmain() が実行を開始する前にスローされるすべての例外を処理する
CERT C++:ERR59-CPPDo not throw an exception across execution boundaries (R2022b 以降)
CERT C++:ERR60-CPPException objects must be nothrow copy constructible (R2021a 以降)
CERT C++:ERR61-CPPlvalue 参照による例外のキャッチ
CERT C++:ERR62-CPPDetect errors when converting a string to a number (R2023b 以降)
CERT C++:OOP50-CPPDo not invoke virtual functions from constructors or destructors (R2021a 以降)
CERT C++:OOP51-CPPDo not slice derived objects
CERT C++: OOP52-CPPDo not delete a polymorphic object without a virtual destructor
CERT C++: OOP53-CPPコンストラクター メンバーの初期化子を正規順序で書き込む
CERT C++:OOP54-CPPGracefully handle self-copy assignment
CERT C++:OOP55-CPPDo not use pointer-to-member operators to access nonexistent members (R2022a 以降)
CERT C++:OOP56-CPPHonor replacement handler requirements (R2023b 以降)
CERT C++:OOP57-CPPPrefer special member functions and overloaded operators to C Standard Library functions
CERT C++:OOP58-CPPCopy operations must not mutate the source object
CERT C++: CON33-CAvoid race conditions when using library functions
CERT C++: CON37-CDo not call signal() in a multithreaded program
CERT C++: CON40-CDo not refer to an atomic variable twice in an expression
CERT C++: CON41-CWrap functions that can fail spuriously in a loop
CERT C++: CON43-CDo not allow data races in multithreaded code
CERT C++: CON50-CPPロック中はミューテックスを破棄しない
CERT C++:CON51-CPPEnsure actively held locks are released on exceptional conditions (R2023b 以降)
CERT C++:CON52-CPPPrevent data races when accessing bit-fields from multiple threads
CERT C++: CON53-CPPAvoid deadlock by locking in a predefined order
CERT C++: CON54-CPPWrap functions that can spuriously wake up in a loop
CERT C++:CON55-CPPPreserve thread safety and liveness when using condition variables (R2023b 以降)
CERT C++:CON56-CPPDo not speculatively lock a non-recursive mutex that is already owned by the calling thread (R2023b 以降)
CERT C++: ENV30-CDo not modify the object referenced by the return value of certain functions
CERT C++: ENV31-C環境ポインターを無効にする可能性のある操作の後にその環境ポインターに依存しない
CERT C++: ENV32-Cすべての終了ハンドラーは正常に戻らなければならない
CERT C++: ENV33-CDo not call system()
CERT C++: ENV34-CDo not store pointers returned by certain functions
CERT C++: FLP30-C浮動小数点変数をループ カウンターとして使用しない
CERT C++: FLP32-CPrevent or detect domain and range errors in math functions
CERT C++: FLP34-CEnsure that floating-point conversions are within range of the new type
CERT C++: FLP36-CPreserve precision when converting integral values to floating-point type
CERT C++: FLP37-C浮動小数点値の比較にオブジェクト表現を使用しない
CERT C++:MSC30-CDo not use the rand() function for generating pseudorandom numbers
CERT C++: MSC32-CProperly seed pseudorandom number generators
CERT C++: MSC33-CDo not pass invalid data to the asctime() function
CERT C++: MSC37-CEnsure that control never reaches the end of a non-void function
CERT C++: MSC38-Cマクロとして実装されている可能性のある定義済みの識別子をオブジェクトとして扱わない
CERT C++: MSC39-CDo not call va_arg() on a va_list that has an indeterminate value
CERT C++: MSC40-C制約に違反しない
CERT C++: MSC41-CNever hard code sensitive information
CERT C++:MSC50-CPPDo not use std::rand() for generating pseudorandom numbers
CERT C++: MSC51-CPPEnsure your random number generator is properly seeded
CERT C++: MSC52-CPPValue-returning functions must return a value from all exit paths
CERT C++: MSC53-CPPDo not return from a function declared [[noreturn]]
CERT C++:MSC54-CPPA signal handler must be a plain old function (R2023b 以降)
CERT C++:PRE30-C連結からユニバーサル文字名を作成しない
CERT C++: PRE31-C安全でないマクロに対する引数の二次的影響を避ける
CERT C++: PRE32-C関数形式のマクロの呼び出しでプリプロセッサ命令を使用しない
CERT C++: SIG31-C信号ハンドラー内の共有オブジェクトにアクセスしない
CERT C++: SIG34-C中断可能な信号ハンドラー内から signal() を呼び出さない
CERT C++: SIG35-C計算例外の信号ハンドラーから値を返さない

トピック