このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
CERT C++ ルール
CERT C++ はソフトウェア開発者向けの一連のコード ガイドラインです。C++ 言語での安全なコーディングを中心としています。このガイドラインは、実行時に予期しない結果を招き、セキュリティの脆弱性が外部にさらされる可能性のある未定義の動作を含む構文を取り除くのに役立ちます。CERT C++ ルールに対する Polyspace の対応範囲を確認するには、Polyspace でのコーディング規約のサポートを参照してください。Polyspace では、CERT C++ 標準に対してコードをチェックできます。[SEI CERT-C++ をチェック] (-cert-cpp)
解析オプションを使用して、このルールのサブセットを有効にします。
Polyspace 結果
CERT C++: DCL30-C | Declare objects with appropriate storage durations |
CERT C++: DCL39-C | Avoid information leakage in structure padding |
CERT C++: DCL40-C | Do not create incompatible declarations of the same function or object |
CERT C++: DCL50-CPP | Do not define a C-style variadic function |
CERT C++: DCL51-CPP | 予約済みの識別子を宣言または定義しない |
CERT C++: DCL52-CPP | const または volatile で参照型を修飾しない |
CERT C++: DCL53-CPP | 構文的にあいまいな宣言を記述しない |
CERT C++: DCL54-CPP | 割り当て関数と割り当て解除関数を同じスコープ内でペアとしてオーバーロード |
CERT C++:DCL55-CPP | Avoid information leakage when passing a class object across a trust boundary (R2022b 以降) |
CERT C++:DCL56-CPP | Avoid cycles during initialization of static objects (R2022b 以降) |
CERT C++:DCL57-CPP | Do not let exceptions escape from destructors or deallocation functions |
CERT C++: DCL58-CPP | 標準の名前空間を変更しない |
CERT C++:DCL59-CPP | Do not define an unnamed namespace in a header file |
CERT C++: DCL60-CPP | Obey the one-definition rule |
CERT C++: EXP34-C | Do not dereference null pointers |
CERT C++: EXP35-C | 有効期間が一時的なオブジェクトを変更しない |
CERT C++: EXP36-C | Do not cast pointers into more strictly aligned pointer types |
CERT C++: EXP37-C | Call functions with the correct number and type of arguments |
CERT C++: EXP39-C | Do not access a variable through a pointer of an incompatible type |
CERT C++: EXP42-C | パディング データを比較しない |
CERT C++: EXP45-C | Do not perform assignments in selection statements |
CERT C++: EXP46-C | boolean 形式のオペランドと一緒にビット演算子を使用しない |
CERT C++: EXP47-C | 無効な型の引数を使用して va_arg を呼び出さない |
CERT C++: EXP50-CPP | 二次的影響に関して評価の順序に依存しない |
CERT C++:EXP51-CPP | Do not delete an array through a pointer of the incorrect type (R2022b 以降) |
CERT C++:EXP52-CPP | Do not rely on side effects in unevaluated operands |
CERT C++: EXP53-CPP | Do not read uninitialized memory |
CERT C++: EXP54-CPP | Do not access an object outside of its lifetime |
CERT C++: EXP55-CPP | Do not access a cv-qualified object through a cv-unqualified type |
CERT C++:EXP56-CPP | Do not call a function with a mismatched language linkage (R2023b 以降) |
CERT C++:EXP57-CPP | Do not cast or delete pointers to incomplete classes |
CERT C++: EXP58-CPP | 適切な型のオブジェクトを va_start に渡す |
CERT C++: EXP59-CPP | 有効な型およびメンバーに対して offsetof() を使用する |
CERT C++:EXP60-CPP | Do not pass a nonstandard-layout type object across execution boundaries (R2023b 以降) |
CERT C++:EXP61-CPP | A lambda object must not outlive any of its reference captured objects |
CERT C++:EXP62-CPP | Do not access the bits of an object representation that are not part of the object's value representation (R2022b 以降) |
CERT C++:EXP63-CPP | Do not rely on the value of a moved-from object (R2021a 以降) |
CERT C++: INT30-C | Ensure that unsigned integer operations do not wrap |
CERT C++: INT31-C | Ensure that integer conversions do not result in lost or misinterpreted data |
CERT C++: INT32-C | Ensure that operations on signed integers do not result in overflow |
CERT C++: INT33-C | Ensure that division and remainder operations do not result in divide-by-zero errors |
CERT C++: 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 |
CERT C++: INT35-C | Use correct integer precisions |
CERT C++: INT36-C | Converting a pointer to integer or integer to pointer |
CERT C++:INT50-CPP | Do not cast to an out-of-range enumeration value (R2023b 以降) |
CERT C++: ARR30-C | Do not form or use out-of-bounds pointers or array subscripts |
CERT C++: ARR37-C | Do not add or subtract an integer to a pointer to a non-array object |
CERT C++: ARR38-C | Guarantee that library functions do not form invalid pointers |
CERT C++: ARR39-C | Do not add or subtract a scaled integer to a pointer |
CERT C++: CTR50-CPP | Guarantee that container indices and iterators are within the valid range |
CERT C++:CTR51-CPP | Use valid references, pointers, and iterators to reference elements of a container (R2022a 以降) |
CERT C++:CTR52-CPP | Guarantee that library functions do not overflow (R2022b 以降) |
CERT C++:CTR53-CPP | Use valid iterator ranges (R2022b 以降) |
CERT C++:CTR54-CPP | Do not subtract iterators that do not refer to the same container (R2022b 以降) |
CERT C++:CTR55-CPP | Do not use an additive operator on an iterator if the result would overflow (R2022b 以降) |
CERT C++:CTR56-CPP | Do not use pointer arithmetic on polymorphic objects (R2023a 以降) |
CERT C++:CTR57-CPP | Provide a valid ordering predicate (R2022a 以降) |
CERT C++:CTR58-CPP | Predicate function objects should not be mutable (R2022a 以降) |
CERT C++: STR30-C | Do not attempt to modify string literals |
CERT C++: STR31-C | Guarantee that storage for strings has sufficient space for character data and the null terminator |
CERT C++: STR32-C | Do not pass a non-null-terminated character sequence to a library function that expects a string |
CERT C++: STR34-C | Cast characters to unsigned char before converting to larger integer sizes |
CERT C++: STR37-C | 文字処理関数の引数は符号なし char で表現できなければならない |
CERT C++: STR38-C | ナロー文字列およびワイド文字列と関数を混同しない |
CERT C++: STR50-CPP | Guarantee that storage for strings has sufficient space for character data and the null terminator |
CERT C++:STR51-CPP | Do not attempt to create a std::string from a null pointer (R2022b 以降) |
CERT C++:STR52-CPP | Use valid references, pointers, and iterators to reference elements of a basic_string (R2022b 以降) |
CERT C++:STR53-CPP | Range check element access |
CERT C++: MEM30-C | Do not access freed memory |
CERT C++: MEM31-C | Free dynamically allocated memory when no longer needed |
CERT C++: MEM34-C | Only free memory allocated dynamically |
CERT C++: MEM35-C | Allocate sufficient memory for an object |
CERT C++: MEM36-C | realloc() を呼び出してオブジェクトのアライメントを変更しない |
CERT C++: MEM50-CPP | Do not access freed memory |
CERT C++: MEM51-CPP | Properly deallocate dynamically allocated resources |
CERT C++: MEM52-CPP | Detect and handle memory allocation errors |
CERT C++:MEM53-CPP | Explicitly construct and destruct objects when manually managing object lifetime (R2022b 以降) |
CERT C++:MEM54-CPP | Provide placement new with properly aligned pointers to sufficient storage capacity |
CERT C++:MEM55-CPP | Honor replacement dynamic storage management requirements |
CERT C++:MEM56-CPP | Do not store an already-owned pointer value in an unrelated smart pointer (R2021a 以降) |
CERT C++:MEM57-CPP | Avoid using default operator new for over-aligned types |
CERT C++: FIO30-C | Exclude user input from format strings |
CERT C++: FIO32-C | Do not perform operations on devices that are only appropriate for files |
CERT C++: FIO34-C | Distinguish between characters read from a file and EOF or WEOF |
CERT C++: FIO37-C | Do not assume that fgets() or fgetws() returns a nonempty string when successful |
CERT C++: FIO38-C | FILE オブジェクトをコピーしない |
CERT C++: FIO39-C | フラッシュまたは位置付け呼び出しの介在なしでのストリームからの入出力を交互実行しない |
CERT C++: FIO40-C | fgets() または fgetws() 失敗時に文字列をリセットする |
CERT C++: FIO41-C | 二次的影響があるストリーム引数を使用して getc()、putc()、getwc()、putwc() を呼び出さない |
CERT C++: FIO42-C | Close files when they are no longer needed |
CERT C++: FIO44-C | fgetpos() から返された fsetpos() の値のみを使用する |
CERT C++: FIO45-C | Avoid TOCTOU race conditions while accessing files |
CERT C++: FIO46-C | Do not access a closed file |
CERT C++: FIO47-C | Use valid format strings |
CERT C++: FIO50-CPP | 位置付け呼び出しの介在なしでのファイル ストリームからの入出力を交互実行しない |
CERT C++: FIO51-CPP | Close files when they are no longer needed |
CERT C++: ERR30-C | Set 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-C | errno の不確定の値に依存しない |
CERT C++: ERR33-C | 標準ライブラリのエラーを検出および処理する |
CERT C++: ERR34-C | 文字列を数値に変換する際にエラーを検出する |
CERT C++: ERR50-CPP | Do not abruptly terminate the program |
CERT C++: ERR51-CPP | Handle all exceptions |
CERT C++: ERR52-CPP | Do not use setjmp() or longjmp() |
CERT C++: ERR53-CPP | Do not reference base classes or class data members in a constructor or destructor function-try-block handler |
CERT C++: ERR54-CPP | Catch handlers should order their parameter types from most derived to least derived |
CERT C++: ERR55-CPP | Honor exception specifications |
CERT C++:ERR56-CPP | Guarantee exception safety (R2022a 以降) |
CERT C++:ERR57-CPP | Do not leak resources when handling exceptions (R2021a 以降) |
CERT C++:ERR58-CPP | main() が実行を開始する前にスローされるすべての例外を処理する |
CERT C++:ERR59-CPP | Do not throw an exception across execution boundaries (R2022b 以降) |
CERT C++:ERR60-CPP | Exception objects must be nothrow copy constructible (R2021a 以降) |
CERT C++:ERR61-CPP | lvalue 参照による例外のキャッチ |
CERT C++:ERR62-CPP | Detect errors when converting a string to a number (R2023b 以降) |
CERT C++:OOP50-CPP | Do not invoke virtual functions from constructors or destructors (R2021a 以降) |
CERT C++:OOP51-CPP | Do not slice derived objects |
CERT C++: OOP52-CPP | Do not delete a polymorphic object without a virtual destructor |
CERT C++: OOP53-CPP | コンストラクター メンバーの初期化子を正規順序で書き込む |
CERT C++:OOP54-CPP | Gracefully handle self-copy assignment |
CERT C++:OOP55-CPP | Do not use pointer-to-member operators to access nonexistent members (R2022a 以降) |
CERT C++:OOP56-CPP | Honor replacement handler requirements (R2023b 以降) |
CERT C++:OOP57-CPP | Prefer special member functions and overloaded operators to C Standard Library functions |
CERT C++:OOP58-CPP | Copy operations must not mutate the source object |
CERT C++: CON33-C | Avoid race conditions when using library functions |
CERT C++: CON37-C | Do not call signal() in a multithreaded program |
CERT C++: CON40-C | Do not refer to an atomic variable twice in an expression |
CERT C++: CON41-C | Wrap functions that can fail spuriously in a loop |
CERT C++: CON43-C | Do not allow data races in multithreaded code |
CERT C++: CON50-CPP | ロック中はミューテックスを破棄しない |
CERT C++:CON51-CPP | Ensure actively held locks are released on exceptional conditions (R2023b 以降) |
CERT C++:CON52-CPP | Prevent data races when accessing bit-fields from multiple threads |
CERT C++: CON53-CPP | Avoid deadlock by locking in a predefined order |
CERT C++: CON54-CPP | Wrap functions that can spuriously wake up in a loop |
CERT C++:CON55-CPP | Preserve thread safety and liveness when using condition variables (R2023b 以降) |
CERT C++:CON56-CPP | Do not speculatively lock a non-recursive mutex that is already owned by the calling thread (R2023b 以降) |
CERT C++: ENV30-C | Do not modify the object referenced by the return value of certain functions |
CERT C++: ENV31-C | 環境ポインターを無効にする可能性のある操作の後にその環境ポインターに依存しない |
CERT C++: ENV32-C | すべての終了ハンドラーは正常に戻らなければならない |
CERT C++: ENV33-C | Do not call system() |
CERT C++: ENV34-C | Do not store pointers returned by certain functions |
CERT C++: FLP30-C | 浮動小数点変数をループ カウンターとして使用しない |
CERT C++: FLP32-C | Prevent or detect domain and range errors in math functions |
CERT C++: FLP34-C | Ensure that floating-point conversions are within range of the new type |
CERT C++: FLP36-C | Preserve precision when converting integral values to floating-point type |
CERT C++: FLP37-C | 浮動小数点値の比較にオブジェクト表現を使用しない |
CERT C++:MSC30-C | Do not use the rand() function for generating pseudorandom numbers |
CERT C++: MSC32-C | Properly seed pseudorandom number generators |
CERT C++: MSC33-C | Do not pass invalid data to the asctime() function |
CERT C++: MSC37-C | Ensure that control never reaches the end of a non-void function |
CERT C++: MSC38-C | マクロとして実装されている可能性のある定義済みの識別子をオブジェクトとして扱わない |
CERT C++: MSC39-C | Do not call va_arg() on a va_list that has an indeterminate value |
CERT C++: MSC40-C | 制約に違反しない |
CERT C++: MSC41-C | Never hard code sensitive information |
CERT C++:MSC50-CPP | Do not use std::rand() for generating pseudorandom numbers |
CERT C++: MSC51-CPP | Ensure your random number generator is properly seeded |
CERT C++: MSC52-CPP | Value-returning functions must return a value from all exit paths |
CERT C++: MSC53-CPP | Do not return from a function declared [[noreturn]] |
CERT C++:MSC54-CPP | A 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 | 計算例外の信号ハンドラーから値を返さない |
トピック
- Polyspace でのコーディング規約のサポート
Polyspace でのさまざまなコーディング規約のサポートをチェックする。
- コーディング規約違反のチェックおよびレビュー
Polyspace Bug Finder で AUTOSAR C++14、CERT® C、CERT C++、CWE、MISRA C™、MISRA® C++、JSF AV C++、または ISO-17961 規格の違反をチェックする。
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)