Skip to main content

C++のスキャンルール

 

Contrast Scanでは、C++に対して以下のルールをサポートしています。

深刻度

Contrastルール

エンジンルールID

説明

重大

Avoid Comp Diff Types

OPT.CPP.AvoidCompDiffTypes 

AvoidCompDiffTypes:基本型が異なる変数の比較禁止

重大

Adding or subtracting an integer to a pointer if resulting value does not refer to a valid array element 

OPT.CPP.CERTC.ARR38 

ARR38:結果の値が有効な配列要素を参照していない場合の配列ポインタの加算または減算の禁止

重大

NULL Pointer Dereference 

OPT.CPP.CERTC.EXP34 

EXP34:NULLポインタの参照禁止

重大

Do not access freed memory 

OPT.CPP.CERTC.MEM30 

MEM30:解放されたメモリにアクセスしない(解放後の使用)

重大

Freeing Memory not on the Heap 

OPT.CPP.CERTC.MEM34 

MEM34:ヒープ上にないメモリの解放の禁止

重大

Do not replace secure functions with less secure functions 

OPT.CPP.CERTC.PRE09 

PRE09:関数のセキュアの低い関数への置き換え禁止

重大

Signal Handler Use of a Non-reentrant Function 

OPT.CPP.CERTC.SIG30 

SIG30:シグナルハンドラでの再入可能でない関数の使用

重大

Signal Handler Use of a Non-reentrant Function 

OPT.CPP.CERTC.SIG32 

SIG32:シグナルハンドラでの再入可能でない関数の使用

重大

Guarantee that storage for strings has sufficient space 

OPT.CPP.CERTC.STR31 

STR31:文字列用の保存領域に文字データとnull終端文字の十分なスペースの確保

重大

Size wide character strings correctly 

OPT.CPP.CERTC.STR33 

STR33:ワイド文字の文字列のサイズを正しく指定

重大

Do not copy data from an unbounded source to a fixed-length array 

OPT.CPP.CERTC.STR35 

STR35:長さに制限のないデータの固定長配列へのコピーの禁止

重大

Destructors Must Be Noexcept 

OPT.CPP.COREGL.DestructorsMustBeNoexcept 

DestructorsMustBeNoexcept:デストラクタは「noexcept」にすることが必要

重大

Multiple Mutexes Acquired On Separate Locks 

OPT.CPP.COREGL.MultipleMutexesAcquiredOnSeparateLocks 

MultipleMutexesAcquiredOnSeparateLocks:複数のmutexを単一のロックで取得

重大

Temporary R A I I Object 

OPT.CPP.COREGL.TemporaryRAIIObject 

TemporaryRAIIObject:一時的なRAIIオブジェクト

重大

Wait Without Condition 

OPT.CPP.COREGL.WaitWithoutCondition 

WaitWithoutCondition:条件なしで「std::condition_variable::wait()」の呼び出し

重大

Check Return In Public Functions 

OPT.CPP.CheckReturnInPublicFunctions 

CheckReturnInPublicFunctions:関数はローカル変数のポインタや参照の返却の禁止

重大

Number Args In Calls Must Match Formal Params 

OPT.CPP.MISRAC.NumberArgsInCallsMustMatchFormalParams 

NumberArgsInCallsMustMatchFormalParams:MISRA 16.6:関数に渡される仮引数と実際のパラメーターの数の一致が必要

重大

Avoid Throw Exception In Destructor 

OPT.CPP.AvoidThrowExceptionInDestructor 

AvoidThrowExceptionInDestructor:デストラクタから例外スローの禁止

重大

Braces In Array Delete 

OPT.CPP.BracesInArrayDelete 

BraceInArrayDelete:new[]で割り当てた配列はdelete[]で解放しなければならない

重大

Class With New Must Define Copy Cons And Assignment Op 

OPT.CPP.ClassWithNewMustDefineCopyConsAndAssignmentOp 

ClassWithNewMustDefineCopyConsAndAssignmentOp:データメンバーにメモリを割り当てるクラスは、コピーコンストラクタと割り当て演算子を定義する必要

重大

No Base Class Without Virtual Destructor 

OPT.CPP.NoBaseClassWithoutVirtualDestructor 

NoBaseClassWithoutVirtualDestructor:すべての基底クラスに仮想デストラクタの定義

重大

No Global Objects In Const And Destr 

OPT.CPP.NoGlobalObjectsInConstAndDestr 

NoGlobalObjectsInConstAndDestr:コンストラクタとデストラクタでグローバルオブジェクトは使わない

重大

No Member In Class Definition 

OPT.CPP.NoMemberInClassDefinition 

NoMemberInClassDefinition:クラス定義内にメンバ関数を定義しない

重大

No Virtual Method Calls In Const Or Destr 

OPT.CPP.NoVirtualMethodCallsInConstOrDestr 

NoVirtualMethodCallsInConstOrDestr:コンストラクタやデストラクタからの仮想関数の呼び出し回避

重大

Virtual Destructor If Virtual Method 

OPT.CPP.VirtualDestructorIfVirtualMethod 

VirtualDestructorIfVirtualMethod:少なくとも1つの仮想メソッドを持つ場合、仮想デストラクタを持つことが必要

重大

Write Operator Delete With Operator New 

OPT.CPP.WriteOperatorDeleteWithOperatorNew 

WriteOperatorDeleteWithOperatorNew:「new」が実装されていれば 「delete」の実装が必要

重大

Anonymous Ldap Bind

OPT.CPP.SEC.AnonymousLdapBind 

AnonymousLdapBind:アクセス制御 - 匿名LDAPバインドの検出

重大

Path Traversal

OPT.CPP.SEC.PathTraversal 

PathTraversal:リソースへのパス名で構成される、無害化されていないユーザ制御の入力の回避

重大

Static Database Connection

OPT.CPP.SEC.StaticDatabaseConnection 

StaticDatabaseConnection:静的なデータベース接続/セッション

重大

Unsafe Chroot 

OPT.CPP.SEC.UnsafeChroot 

UnsafeChroot:安全でないchrootの呼び出し

重大

Exclude unsanitized input 

OPT.CPP.CERTC.FIO30 

FIO30:サニタイズされていないユーザー入力をフォーマット文字列から除外

重大

Sanitize data passed to sensitive subsystems 

OPT.CPP.CERTC.STR02 

STR02:機密性の高いサブシステムに渡されるデータのサニタイズ

重大

Connection String Parameter Pollution

OPT.CPP.SEC.ConnectionStringParameterPollution 

ConnectionStringParameterPollution::信頼できない入力で汚染された接続文字列

重大

DoS Regexp

OPT.CPP.SEC.DoSRegexp 

DoSRegexp:悪意のある正規表現によるDos攻撃の防止(正規表現インジェクション)

重大

Ldap Injection

OPT.CPP.SEC.LdapInjection 

LdapInjection:LDAP検索フィルタにおける無害化されていないユーザ制御入力の回避

重大

No SQL Injection

OPT.CPP.SEC.NoSQLInjection 

NoSQLInjection:データクエリロジックにおける特殊要素の不適切な無害化(NoSQLインジェクション)

重大

Process Control

OPT.CPP.SEC.ProcessControl 

ProcessControl::信頼できないソースからの実行可能ファイルまたはライブラリのロードの禁止

重大

SQL Injection

OPT.CPP.SEC.SqlInjection 

SqlInjection:SQLコマンドで使用する特殊要素の不適切な無害化(SQLインジェクション) 

重大

Xml Entity Injection

OPT.CPP.SEC.XmlEntityInjection 

XmlEntityInjection:XMLエンティティインジェクション

重大

Hardcoded Crypto Key

OPT.CPP.SEC.HardcodedCryptoKey 

HardcodedCryptoKey:ハードコードされた暗号鍵

Avoid Auto Ptr 

OPT.CPP.AvoidAutoPtr 

AvoidAutoPtr:「auto_ptr」の使用回避

Avoid Calling Too Many Other Components 

OPT.CPP.AvoidCallingTooManyOtherComponents 

AvoidCallingTooManyOtherComponents:他のコンポーネントの呼び出しが多すぎるコンポーネントの回避

Avoid Excessive Nested Statements

OPT.CPP.AvoidExcessiveNestedStatements 

AvoidExcessiveNestedStatements:制御フローのネストが多すぎるのを回避

Avoid Object Instantiation Into Loops 

OPT.CPP.AvoidObjectInstantiationIntoLoops 

AvoidObjectInstantiationIntoLoops:ループでのオブジェクトのインスタンス化の回避

Avoid Signal Managment Functions 

OPT.CPP.AvoidSignalManagmentFunctions 

AvoidSignalManagmentFunctions:シグナル管理関数の使用の回避

Avoid Structures 

OPT.CPP.AvoidStructures 

AvoidStructures: 特定の種類の集約オブジェクト(struct、union、VARIANT)の使用の回避

Avoid Too Complex Functions

OPT.CPP.AvoidTooComplexFunctions 

AvoidTooComplexFunctions:循環的複雑度の高い関数の使用の回避

Avoid Too Complex Programs 

OPT.CPP.AvoidTooComplexPrograms 

AvoidTooComplexPrograms:循環的複雑度の高いプログラムの回避

Do not apply the sizeof operator to a pointer when taking the size of an array 

OPT.CPP.CERTC.ARR01 

ARR01:配列のサイズを取得する際のポインタに対するsizeof演算子の使用禁止

Guarantee that copies are made into storage of sufficient size 

OPT.CPP.CERTC.ARR33 

ARR33:コピーが十分なサイズのストレージに作成されることの保証

Assumptions about the size of an environment variable 

OPT.CPP.CERTC.ENV01 

ENV01:環境変数のサイズを仮定することは禁止

Terminating Atexit handler by returning 

OPT.CPP.CERTC.ENV32 

ENV32:「atexit」で登録したハンドラ関数は必ず「return」が必要

Use of sizeof() on a Pointer Type 

OPT.CPP.CERTC.EXP01 

EXP01:ポインタ型での「sizeof()」の使用の禁止

Use of Uninitialized Variable 

OPT.CPP.CERTC.EXP33 

EXP33:初期化されていない変数の読み取りの禁止

Functions using file names for identification 

OPT.CPP.CERTC.FIO01 

FIO01:ファイル名を識別に使用する関数の使用に注意

Do not assume a new-line character is read when using fgets() 

OPT.CPP.CERTC.FIO36 

FIO36:「fgets()」の使用時に改行文字が読み込まれたと仮定することは禁止

Do not assume character data has been read 

OPT.CPP.CERTC.FIO37 

FIO37:文字データの読み取り成功時に空でない文字列を返すという想定の禁止

Check number of bits in shift operations 

OPT.CPP.CERTC.INT34 

INT34:負のビット数または左オペランドに存在するビット数より多いビットのシフト演算の禁止

Allocate and free memory in the same module 

OPT.CPP.CERTC.MEM00 

MEM00:メモリの割り当てと解放は、同じ翻訳単位内の同一抽象レベルで行うことが必要

Only Free allocated memory once 

OPT.CPP.CERTC.MEM31 

MEM31:動的に割り当てられたメモリの解放は一度だけに限る(解放の重複)

Detect and handle memory allocation errors 

OPT.CPP.CERTC.MEM32 

MEM32:メモリ割り当て時のエラーの検出と処理が必要

Race condition with link following 

OPT.CPP.CERTC.POS35 

POS35:シンボリックリンクの存在をチェックする際の競合状態の回避

Observe correct revocation order while relinquishing privileges 

OPT.CPP.CERTC.POS36 

POS36:権限を廃棄する場合は正しい失効順序が必要

Improper Check for Dropped Privileges 

OPT.CPP.CERTC.POS37 

POS37:権限の破棄での結果の確認

Macro replacement lists should be parenthesized 

OPT.CPP.CERTC.PRE02 

PRE02:マクロ置換リストは括弧で囲む事が必要

Avoid using signals to implement normal functionality 

OPT.CPP.CERTC.SIG02 

SIG02:標準的な機能を実装する際はシグナルの使用の回避

Ensure strtok() leaves the parse string unchanged 

OPT.CPP.CERTC.STR06 

STR06:「strtok()」が分割対象文字列を変更しないと想定することの禁止

Use TR 24731 for remediation of existing string manipulation 

OPT.CPP.CERTC.STR07 

STR07:既存の文字列操作コードの修正に「ISO/IEC TR 24731」関数の使用

Null-terminate byte strings as required 

OPT.CPP.CERTC.STR32 

STR32:必要に応じた文字列のNull終端が必要

Do not specify the bound of a character array initialized with a string literal 

OPT.CPP.CERTC.STR36 

STR36:文字列リテラルで初期化された文字配列の変更の禁止

Avoid Lock Unlock On Mutex 

OPT.CPP.COREGL.AvoidLockUnlockOnMutex 

AvoidLockUnlockOnMutex:RAIIラッパー代わりに、mutexの手動でのロック/アンロックを使わない

Call Depends On Arguments Eval Order 

OPT.CPP.COREGL.CallDependsOnArgumentsEvalOrder 

CallDependsOnArgumentsEvalOrder:呼び出しは引数の評価順序によって異なる

Detached Thread 

OPT.CPP.COREGL.DetachedThread 

DetachedThread:デタッチされたスレッドの存在

Dont Heap Allocate Movable Result 

OPT.CPP.COREGL.DontHeapAllocateMovableResult 

DontHeapAllocateMovableResult:その型にムーブコンストラクタがある場合、ヒープに割り当てされたオブジェクトではなく、スコープ内のオブジェクトが返される

Generic Exception Throw 

OPT.CPP.COREGL.GenericExceptionThrow 

GenericExceptionThrow:generic例外のスローの禁止

Move Swap Should Be No Except 

OPT.CPP.COREGL.MoveSwapShouldBeNoExcept 

MoveSwapShouldBeNoExcept:ムーブコンストラクタ、ムーブ代入演算子、スワップ関数は「noexcept」の指定が必要

Suspicious Rvalue Forward Reference 

OPT.CPP.COREGL.SuspiciousRvalueForwardReference 

SuspiciousRvalueForwardReference:疑わしい完全転送(forward)とrvalueリファレンス

Correct Use Memory Leaks 

OPT.CPP.CorrectUseMemoryLeaks 

CorrectUseMemoryLeaks:割り当てられたメモリは同じスコープ内で解放が必要

Dont Use Memory Function 

OPT.CPP.DontUseMemoryFunction 

DontUseMemoryFunction:malloc、calloc、realloc、freeの使用禁止

Global Var Not Used Locally 

OPT.CPP.GlobalVarNotUsedLocally 

GlobalVarNotUsedLocally:ローカルで使用されていないグローバル変数

Implicit Type Conversion 

OPT.CPP.ImplicitTypeConversion 

ImplicitTypeConversion:暗黙の型変換を引き起こす関数呼び出しの回避

Local Vars With Global Names 

OPT.CPP.LocalVarsWithGlobalNames 

LocalVarsWithGlobalNames:グローバル変数とローカル変数における同じ名前の回避

Avoid File Scope When Accessed From Single Function 

OPT.CPP.MISRAC.AvoidFileScopeWhenAccessedFromSingleFunction 

AvoidFileScopeWhenAccessedFromSingleFunction:MISRA 8.7:オブジェクトが単一の関数からのみアクセスされる場合、ブロックスコープで定義することが必要

Avoid Recursive Functions 

OPT.CPP.MISRAC.AvoidRecursiveFunctions 

AvoidRecursiveFunctions:MISRA 16.2:関数は直接的にも間接的にも自分自身の呼び出しを禁止

Do Not Check Float Equal Not Equal 

OPT.CPP.MISRAC.DoNotCheckFloatEqualNotEqual 

DoNotCheckFloatEqualNotEqual:MISRA 13.3:浮動小数点型は等号または不等号での判定は禁止

Do Not Use Dynamic Heap Allocation 

OPT.CPP.MISRAC.DoNotUseDynamicHeapAllocation 

DoNotUseDynamicHeapAllocation:MISRA 20.4:動的ヒープ割り当ての使用禁止

Do Not Use Reserved Name As Identifier 

OPT.CPP.MISRAC.DoNotUseReservedNameAsIdentifier 

DoNotUseReservedNameAsIdentifier:MISRA 20.2:標準ライブラリのマクロ、オブジェクト、関数の名前の再利用は禁止

Do Not Use Reserved Name As Macro Name 

OPT.CPP.MISRAC.DoNotUseReservedNameAsMacroName 

DoNotUseReservedNameAsMacroName:MISRA 20.1:標準ライブラリの予約済み識別子、マクロ、関数の定義、再定義、未定義は禁止

Do Not Use Setjmp Longjmp 

OPT.CPP.MISRAC.DoNotUseSetjmpLongjmp 

DoNotUseSetjmpLongjmp:MISRA 20.7:「setjmp」マクロおよび 「longjmp」関数の使用禁止

Do Not Use Signal Handling Functions 

OPT.CPP.MISRAC.DoNotUseSignalHandlingFunctions 

DoNotUseSignalHandlingFunctions:MISRA 20.8:「signal.h」のシグナル処理機能の使用禁止

Do Not Use Stdio Functions 

OPT.CPP.MISRAC.DoNotUseStdioFunctions 

DoNotUseStdioFunctions:MISRA 20.9:入出力ライブラリ「stdio.h」を本番環境のコードでの使用禁止

Do Not Use Time Functions 

OPT.CPP.MISRAC.DoNotUseTimeFunctions 

DoNotUseTimeFunctions:MISRA 20.12:ライブラリ「time.h」の時間処理関数の使用禁止

Enclose In Parantheses Macro Args 

OPT.CPP.MISRAC.EncloseInParanthesesMacroArgs 

マクロ引数を括弧で囲む:MISRA 19.10:関数のようなマクロの定義では各パラメータを括弧で囲むことが必要

Explicit Type For Vars Functions 

OPT.CPP.MISRAC.ExplicitTypeForVarsFunctions 

ExplicitTypeForVarsFunctions:MISRA 8.2:オブジェクトまたは関数の宣言または定義には、常にその型の明示が必要

Function Macro Invoked With All Arguments 

OPT.CPP.MISRAC.FunctionMacroInvokedWithAllArguments 

FunctionMacroInvokedWithAllArguments:MISRA 19.8:関数のようなマクロの呼び出しには、すべての引数が必要

Identifiers Must Not Exceed31 Chars 

OPT.CPP.MISRAC.IdentifiersMustNotExceed31Chars 

IdentifiersMustNotExceed31Chars:MISRA 5.1:識別子(内部および外部)は31文字を超えてはならない

Initialise Auto Variables Before Use 

OPT.CPP.MISRAC.InitialiseAutoVariablesBeforeUse 

InitialiseAutoVariablesBeforeUse:MISRA 9.1:すべてのauto変数は使用する前に値を割り当てる必要

Initialization For Array Structs Must Match Layout 

OPT.CPP.MISRAC.InitializationForArrayStructsMustMatchLayout 

InitializationForArrayStructsMustMatchLayout:MISRA 9.2:中括弧により配列と構造体のゼロでない初期化および構造の一致が必要

Proper Bit Field Struct 

OPT.CPP.MISRAC.ProperBitFieldStruct 

ProperBitFieldStruct:MISRA 3.5:構造体内のビットフィールドはint型を使用し、非ビットフィールドとの混在は禁止

Single Definition For External Linkage Identifiers 

OPT.CPP.MISRAC.SingleDefinitionForExternalLinkageIdentifiers 

SingleDefinitionForExternalLinkageIdentifiers:MISRA 8.9:外部リンクを持つ識別子は正しい一つの定義が必要

Multiple Inclusion Prevention Guard 

OPT.CPP.MultipleInclusionPreventionGuard 

MultipleInclusionPreventionGuard:ヘッダでの重複したインクルードの保護

No Specify Unix Names In Include 

OPT.CPP.NoSpecifyUnixNamesInInclude 

NoSpecifyUnixNamesInInclude:「#include」ディレクティブでの絶対パスの禁止

Non Goto Statement 

OPT.CPP.NonGotoStatement 

NonGotoステートメント:goto文の使用禁止

Remove Unused Methods 

OPT.CPP.RemoveUnusedMethods 

RemoveUnusedMethods:未使用の関数の削除

Unspecified Parameters 

OPT.CPP.UnspecifiedParameters 

UnspecifiedParameters: 関数での可変引数(可変数のパラメータ)の回避

Avoid Multiple Inheritance 

OPT.CPP.AvoidMultipleInheritance 

AvoidMultipleInheritance:クラスの多重継承の回避

Avoid Public Data Member 

OPT.CPP.AvoidPublicDataMember 

AvoidPublicDataMember:publicデータメンバーの回避

Dont Use Stdio Lib 

OPT.CPP.DontUseStdioLib 

DontUseStdioLib:「stdio.h」ライブラリの代わりに「iostream.h」の使用

Law Of Big Three 

OPT.CPP.LawOfBigThree 

LawOfBigThree:デストラクタ、コピーコンストラクタ、コピー代入演算子の3つの定義が必要

Remove Unused Members 

OPT.CPP.RemoveUnusedMembers 

RemoveUnusedMembers:使用されていないprivateデータメンバーの削除

Hardcoded Absolute Path

OPT.CPP.PORT.HardcodedAbsolutePath 

HardcodedAbsolutePath:絶対パスのハードコード禁止

Calling system() if you do not need a command processor 

OPT.CPP.CERTC.ENV04 

ENV04:コマンドプロセッサが不要な場合は「system()」の使用禁止

Use int to capture the return value of character I/O functions 

OPT.CPP.CERTC.FIO34 

FIO34:文字I/O関数の戻り値の判定には「int」の使用

Temporary File created with Incorrect Permissions 

OPT.CPP.CERTC.FIO43 

FIO43:不正なアクセス権限のディレクトリでの一時ファイルの作成

Avoid Vararg Functions 

OPT.CPP.MISRAC.AvoidVarargFunctions 

AvoidVarargFunctions:MISRA 16.1:引数の数が可変の関数の定義の禁止

Resource Injection

OPT.CPP.SEC.ResourceInjection 

ResourceInjection:リソース識別子の不適切な制御(リソースインジェクション)

Hardcoded Salt

OPT.CPP.SEC.HardcodedSalt 

HardcodedSalt:ハードコードされたソルトの使用

Insufficient Key Size

OPT.CPP.SEC.InsufficientKeySize 

InsufficientKeySize:脆弱な暗号方式・鍵長の検出

Weak Cryptographic Hash

OPT.CPP.SEC.WeakCryptographicHash 

WeakCryptographicHash:脆弱な暗号化ハッシュ

Weak Encryption

OPT.CPP.SEC.WeakEncryption 

WeakEncryption:脆弱な共通鍵暗号アルゴリズム

情報

Avoid Braces Same Line 

OPT.CPP.AvoidBracesSameLine 

AvoidBracesSameLine:中括弧「{}」は別の行に記述

情報

Avoid Numeric Values 

OPT.CPP.AvoidNumericValues 

AvoidNumericValues:コード内の数値定数の回避

情報

Avoid Question Mark 

OPT.CPP.AvoidQuestionMark 

AvoidQuestionMark::「?:」(三項演算子)の使用の回避

情報

Break In Loops 

OPT.CPP.BreakInLoops 

BreakInLoops:ループ内でのbreak文の使用回避

情報

Avoid Explicit New Delete 

OPT.CPP.COREGL.AvoidExplicitNewDelete 

AvoidExplicitNewDelete:「new」および「delete」演算子の回避

情報

Class Naming Convention 

OPT.CPP.ClassNamingConvention 

ClassNamingConvention:struct、union、class、namespaceの名前は命名規則に従うことが必要

情報

Constant Naming Convention 

OPT.CPP.ConstantNamingConvention 

ConstantNamingConvention:グローバル定数の命名規則

情報

Data Member Naming Convention 

OPT.CPP.DataMemberNamingConvention 

DataMemberNamingConvention:データメンバーの命名規則

情報

Forbidden Functions 

OPT.CPP.ForbiddenFunctions 

ForbiddenFunctions:推奨されない関数の使用の回避

情報

At Most One Break In Loop 

OPT.CPP.MISRAC.AtMostOneBreakInLoop 

AtMostOneBreakInLoop:MISRA 14.6:すべての反復文にはループの終了に使用されるbreak文は1つ以内

情報

Avoid Trigraphs 

OPT.CPP.MISRAC.AvoidTrigraphs 

AvoidTrigraphs:MISRA 4.2:3文字表記の使用禁止

情報

Do Not Comment Out Source Code 

OPT.CPP.MISRAC.DoNotCommentOutSourceCode 

DoNotCommentOutSourceCode:MISRA 2.4:コードの一部のコメントアウトの禁止

情報

Explicit Check Against Zero 

OPT.CPP.MISRAC.ExplicitCheckAgainstZero 

ExplicitCheckAgainstZero:MISRA 13.2:オペランドが実質的にブール値でない限り、ゼロに対する値の明示的な判定が必要

情報

Include Not After Statements 

OPT.CPP.MISRAC.IncludeNotAfterStatements 

IncludeNotAfterStatements:MISRA 19.1:「#include」ディレクティブは、他のプリプロセッサディレクティブやコメントによってのみファイル内で先行することが必要

情報

Macros Naming Convention 

OPT.CPP.MacrosNamingConvention 

MacrosNamingConvention:マクロの命名規則

情報

Maximun Line Size 

OPT.CPP.MaximunLineSize 

MaximunLineSize:MaxLineSize:長すぎるコード行の禁止

情報

Method Naming Convention 

OPT.CPP.MethodNamingConvention 

MethodNamingConvention:関数、クラスメソッドの命名規則

情報

Methods Comment Code Ratio 

OPT.CPP.MethodsCommentCodeRatio 

MethodsCommentCodeRatio:コメント行の比率が低い関数の回避

情報

Parenthesized Functions 

OPT.CPP.ParenthesizedFunctions 

ParenthesizedFunctions: 「sizeof」は括弧を付けて「return」に記述

情報

Space Indentation 

OPT.CPP.SpaceIndentation 

SpaceIndentation:演算子の前後はスペースを入れる

情報

Typedef Naming Convention 

OPT.CPP.TypedefNamingConvention 

TypedefNamingConvention:「typedef」で宣言された型の名前は命名規則に従うことが必要

情報

Use Blocks 

OPT.CPP.UseBlocks 

UseBlocks:条件文や反復文はブロックで使う

情報

Use Setters 

OPT.CPP.UseSetters 

UseSetters:コンストラクタでインスタンス変数の直接代入の禁止

Avoid Dependency Cycles Between Namespaces 

OPT.CPP.AvoidDependencyCyclesBetweenNamespaces 

AvoidDependencyCyclesBetweenNamespaces:名前空間の間での循環的な依存関係の回避

Avoid Many Parameters Function

OPT.CPP.AvoidManyParametersFunction 

AvoidManyParametersFunction:パラメータが多すぎる関数の回避

Avoid One Case Switch 

OPT.CPP.AvoidOneCaseSwitch 

AvoidOneCaseSwitch:case句の数が少ないswitch文の回避

Use consistent array notation across all source files 

OPT.CPP.CERTC.ARR31 

ARR31:すべてのソースファイルで一貫した配列表記の使用

Use bitwise operators only on unsigned operands 

OPT.CPP.CERTC.INT13 

INT13:符号なしオペランドにのみビット演算子の使用

Do not use vfork() 

OPT.CPP.CERTC.POS33 

POS33:「vfork()」の使用禁止

Prefer inline or static functions to function-like macros 

OPT.CPP.CERTC.PRE00 

PRE00:関数形式のようなマクロよりもインライン関数やスタティック関数を優先

Check Names Definition And Declaration 

OPT.CPP.CheckNamesDefinitionAndDeclaration 

CheckNamesDefinitionAndDeclaration:関数定義と宣言における正式なパラメータ名の使用

Class Comment Code Ratio 

OPT.CPP.ClassCommentCodeRatio 

ClassCommentCodeRatio:コメントに対するコードの比率が低いクラス、構造体、ユニオンの回避

Dont Compare Pointer To Null 

OPT.CPP.DontComparePointerToNull 

DontComparePointerToNull:ポインタとNULLの比較禁止

Dont Compare Pointer To Zero 

OPT.CPP.DontComparePointerToZero 

DontComparePointerToZero:ポインタとゼロの比較禁止

Including Header File 

OPT.CPP.IncludingHeaderFile 

IncludingHeaderFile:同じ名前のヘッダーファイルを含まない実装の回避

Initialization Instead Assignment 

OPT.CPP.InitializationInsteadAssignment 

InitializationInsteadAssignment:常に代入の代わりに初期化の使用

Avoid Single Line Comments 

OPT.CPP.MISRAC.AvoidSingleLineComments 

AvoidSingleLineComments:MISRA 2.2:C99/C++に単一行のコメント「//...」は使用禁止

Avoid Unreachable Code 

OPT.CPP.MISRAC.AvoidUnreachableCode 

AvoidUnreachableCode:MISRA 14.1:到達不能コードの存在禁止

Case With Break 

OPT.CPP.MISRAC.CaseWithBreak 

CaseWithBreak:MISRA 15.2:switchブロックの空でないすべてのcase句は無条件のbreak文が必要

Comment Should Not Contain Open Comment Chars 

OPT.CPP.MISRAC.CommentShouldNotContainOpenCommentChars 

CommentShouldNotContainOpenCommentChars:MISRA 2.3:コメントには文字列「/*」が含むことは禁止

Declare Const Pointer Param If Unchanged Value 

OPT.CPP.MISRAC.DeclareConstPointerParamIfUnchangedValue 

DeclareConstPointerParamIfUnchangedValue:MISRA 16.7:関数内の参照パラメータはアドレス指定のオブジェクトを変更するための使用でなければ、「const」として宣言が必要

Do Not Def Undef Macros In Blocks 

OPT.CPP.MISRAC.DoNotDefUndefMacrosInBlocks 

DoNotDefUndefMacrosInBlock:MISRA 19.5:ブロック内でマクロの定義は禁止

Do Not Use Atof Atoi Atol 

OPT.CPP.MISRAC.DoNotUseAtofAtoiAtol 

DoNotUseAtofAtoiAtol:MISRA 20.10:「stdlib.h」のライブラリ関数 atof、atoi、atolの使用禁止

Explicit Size In Extern Arrays 

OPT.CPP.MISRAC.ExplicitSizeInExternArrays 

ExplicitSizeInExternArrays:MISRA 8.12:配列が外部リンクで宣言される場合、そのサイズは明示的に記述されるか初期化によって暗黙的に定義が必要

Function Pointer Casts 

OPT.CPP.MISRAC.FunctionPointerCasts 

FunctionPointerCasts: MISRA 11.1:関数へのポインタと整数型以外の型との間での変換の禁止

If Else If Must End With Else 

OPT.CPP.MISRAC.IfElseIfMustEndWithElse 

IfElseIfMustEndWithElse:MISRA 14.10:すべての「if...else if」構文はelse句での終了が必要

If Else Statements Must Use Braces 

OPT.CPP.MISRAC.IfElseStatementsMustUseBraces 

IfElseStatementsMustUseBraces:MISRA 14.9:「if-else」ステートメントでは中括弧の使用が必要

Logical Expression With Primary Expression Operands 

OPT.CPP.MISRAC.LogicalExpressionWithPrimaryExpressionOperands 

LogicalExpressionWithPrimaryExpressionOperands:MISRA 12.5:論理「&&」または「||」のオペランドは一次式であることが必要

Loops Should Use Braces 

OPT.CPP.MISRAC.LoopsShouldUseBraces 

LoopsShouldUseBraces:MISRA 14.8:ループは中括弧で本体を区切ることが必要

Max Two Pointer Indirections 

OPT.CPP.MISRAC.MaxTwoPointerIndirections 

MaxTwoPointerIndirections:MISRA 17.5:オブジェクトの宣言でポインタ参照は2レベル以下であることが必要

No Pointer Arithmetic Except Array Index 

OPT.CPP.MISRAC.NoPointerArithmeticExceptArrayIndex 

NoPointerArithmeticExceptArrayIndex:MISRA 17.4:配列のインデックス作成はポインタ演算の唯一の許可された形式であることが必要

No Side Effects In Right Operand Of Logical Op 

OPT.CPP.MISRAC.NoSideEffectsInRightOperandOfLogicalOp 

NoSideEffectsInRightOperandOfLogicalOp:MISRA 12.4:論理演算子「&&」または「||」の右辺に副作用を含む式は禁止

Switch Must Have Braces 

OPT.CPP.MISRAC.SwitchMustHaveBraces 

SwitchMustHaveBraces:MISRA 14.8:Switch文は中括弧の使用が必要

Use Static For Internal Linkage Identifiers 

OPT.CPP.MISRAC.UseStaticForInternalLinkageIdentifiers 

UseStaticForInternalLinkageIdentifiers:MISRA 8.11:内部リンケージを持つオブジェクトと関数の定義/宣言には静的なストレージ指定が必要

One Statement Per Line

OPT.CPP.OneStatementPerLine 

OneStatementPerLine:1行には1つのステートメント

Only One Return

OPT.CPP.OnlyOneReturn 

OnlyOneReturn:1つの関数にreturn文は1つ

Parent Class Doesnot Reference Child Classes 

OPT.CPP.ParentClassDoesnotReferenceChildClasses 

ParentClassDoesnotReferenceChildClasses:親クラスから子クラスの参照禁止

Specify Return Type 

OPT.CPP.SpecifyReturnType 

SpecifyReturnType:関数の戻り値の型は明示的な指定が必要

Variables Never Used 

OPT.CPP.VariablesNeverUsed 

VariablesNeverUsed:使用されないローカル変数

Private Data Members 

OPT.CPP.PrivateDataMembers 

PrivateDataMembers:privateデータメンバーの最大数

Private Methods 

OPT.CPP.PrivateMethods 

PrivateMethods:privateメソッドの最大数

Protected Data Members 

OPT.CPP.ProtectedDataMembers 

ProtectedDataMembers:protectedデータメンバーの最大数

Protected Methods 

OPT.CPP.ProtectedMethods 

ProtectedMethods:protectedメソッドの最大数

Specify Section Order 

OPT.CPP.SpecifySectionOrder 

SpecifySectionOrder:コンテナ(class、struct、またはunion)では、特定のアクセス可視性の順序でメンバーを宣言

Avoid Global Vars 

OPT.CPP.AvoidGlobalVars 

AvoidGlobalVars:グローバル変数の使用回避

Avoid Large Methods

OPT.CPP.AvoidLargeMethods 

AvoidLargeMethods:コード行数が多すぎる関数やメソッドの回避

Avoid Volatile Vars 

OPT.CPP.AvoidVolatileVars 

AvoidVolatileVars:volatile変数の使用禁止

Do not form or use out-of-bounds pointers or array subscripts on arrays 

OPT.CPP.CERTC.ARR30 

ARR30:配列の境界外へのポインタや配列添字の作成や使用の禁止

Allowing loops to iterate beyond the end of an array 

OPT.CPP.CERTC.ARR35 

ARR35:ループ処理で配列の終端を超えた反復の禁止

Allowing loops to iterate beyond the end of an array 

OPT.CPP.CERTC.ARR35_bis 

ARR35:ループ処理で配列の終端を超えた反復の禁止

Detect and handle input/output errors 

OPT.CPP.CERTC.FIO33 

FIO33:未定義の入出力エラーの検出と処理

Evaluate integer expressions 

OPT.CPP.CERTC.INT35 

INT35:整数式はより大きい精度で評価した後に、それと同じ精度との比較または代入が必要

Use realloc() to resize dynamically allocated arrays 

OPT.CPP.CERTC.MEM08 

MEM08:「realloc()」は動的に割り当てられた配列のサイズ変更にのみ使用

Incorrect Calculation of Buffer Size 

OPT.CPP.CERTC.MEM35 

MEM35:バッファサイズの間違った計算

Use the readlink() function properly 

OPT.CPP.CERTC.POS30 

POS30:「readlink()」の関数の適切な使用

Use parentheses within macros around parameter names 

OPT.CPP.CERTC.PRE01 

PRE01:マクロ内の引数名は括弧で囲む

Wrap multistatement macros in a do-while loop 

OPT.CPP.CERTC.PRE10 

PRE10:複数の文からなるマクロは「do-while」のループで包む

Catch Exceptions By Reference 

OPT.CPP.COREGL.CatchExceptionsByReference 

CatchExceptionsByReference:例外は常に参照によってキャッチすることが必要

Generic Exception Catch 

OPT.CPP.COREGL.GenericExceptionCatch 

GenericExceptionCatch:Generic例外のキャッチ禁止

Polimorphic Class Should Suppress Copying 

OPT.CPP.COREGL.PolimorphicClassShouldSuppressCopying 

PolimorphicClassShouldSuppressCopying:ポリモーフィック(多態的)クラスはコピーを抑制することが必要

Use Make Factories For Creating Smart Pointers 

OPT.CPP.COREGL.UseMakeFactoriesForCreatingSmartPointers 

UseMakeFactoriesForCreatingSmartPointers:スマートポインタの作成にはファクトリ関数を使用

Dont Convert Const To Non Const 

OPT.CPP.DontConvertConstToNonConst 

DontConvertConstToNonConst:「const」の「non-const」への変換は禁止

Include Headers Only 

OPT.CPP.IncludeHeadersOnly 

IncludeHeadersOnly:ヘッダファイルでないファイルの「#include」での使用の回避

All Macro Identifiers Defined Before Use 

OPT.CPP.MISRAC.AllMacroIdentifiersDefinedBeforeUse 

AllMacroIdentifiersDefinedBeforeUse:MISRA 19.11:プリプロセッサ指示文中のマクロ識別子は「#ifdef」および「#ifndef」指示文と 「defined()」演算子を除いて使用前に定義が必要

Arithmetic On Pointers To Array 

OPT.CPP.MISRAC.ArithmeticOnPointersToArray 

ArithmeticOnPointersToArray:MISRA 17.1:ポインタ演算は配列または配列要素のポインタにのみに適用

Avoid Assignment In Boolean Expressions 

OPT.CPP.MISRAC.AvoidAssignmentInBooleanExpressions 

AvoidAssignmentInBooleanExpressions:MISRA 13.1:代入演算子は真偽値を返す式での使用は禁止

Avoid Comma Operator 

OPT.CPP.MISRAC.AvoidCommaOperator 

AvoidCommaOperator:MISRA 12.10:コンマ演算子の使用は禁止

Avoid Continue Statement 

OPT.CPP.MISRAC.AvoidContinueStatement 

AvoidContinueStatement:MISRA 14.5:Continue文の使用は禁止

Avoid Goto Statement 

OPT.CPP.MISRAC.AvoidGotoStatement 

AvoidGotoStatement:MISRA 14.4:Goto文の使用は禁止

Avoid Non Null Statements Without Effect 

OPT.CPP.MISRAC.AvoidNonNullStatementsWithoutEffect 

AvoidNonNullStatementsWithoutEffect:MISRA 14.2:空ではない行は、少なくとも 1 つの副作用もしくは制御フローを実行することが必要

Avoid Non Standard Chars In Header Filenames 

OPT.CPP.MISRAC.AvoidNonStandardCharsInHeaderFilenames 

AvoidNonStandardCharsInHeaderFilenames:MISRA 19.2:「#include」ディレクティブのヘッダファイル名に非標準文字の使用禁止

Avoid Non Standard Escape Sequences 

OPT.CPP.MISRAC.AvoidNonStandardEscapeSequences 

AvoidNonStandardEscapeSequences:MISRA 4.1:文字定数には、ISO C Standardで定義されているエスケープシーケンスのみ使用

Avoid Octal Constants 

OPT.CPP.MISRAC.AvoidOctalConstants 

AvoidOctalConstants:MISRA 7.1:8進数の定数(0以外)およびエスケープシーケンスの使用禁止

Avoid Undef Directive 

OPT.CPP.MISRAC.AvoidUndefDirective 

AvoidUndefDirective:MISRA 19.6:「#undef」の使用禁止

Avoid Unnecessary External Linkage 

OPT.CPP.MISRAC.AvoidUnnecessaryExternalLinkage 

AvoidUnnecessaryExternalLinkage:MISRA 8.10:外部リンケージが必要でない限り、ファイルスコープ内のオブジェクトまたは関数のすべての宣言と定義は内部リンケージを持つことが必要

Compare Pointers When On Same Array 

OPT.CPP.MISRAC.ComparePointersWhenOnSameArray 

ComparePointersWhenOnSameArray: MISRA 17.3: >, > [] {'MISRA-C': ['17.3']}

Declare Functions At File Scope 

OPT.CPP.MISRAC.DeclareFunctionsAtFileScope 

DeclareFunctionsAtFileScope:MISRA 8.6:関数はファイルスコープ内で宣言が必要

Declare No Parameters Function As Void 

OPT.CPP.MISRAC.DeclareNoParametersFunctionAsVoid 

DeclareNoParametersFunctionAsVoid:MISRA 16.5:引数のない関数は引数に「void」を宣言することが必要

Do Not Mix Inc Dec Operators With Other Operators 

OPT.CPP.MISRAC.DoNotMixIncDecOperatorsWithOtherOperators 

DoNotMixIncDecOperatorsWithOtherOperators:MISRA 12.13:インクリメント「++」およびデクリメント「--」演算子は、式の中で他の演算子との混在は禁止

Do Not Modify Loop Variable In Body 

OPT.CPP.MISRAC.DoNotModifyLoopVariableInBody 

DoNotModifyLoopVariableInBody:MISRA 13.6:反復回数のためにforループ内で使用されている変数の更新は禁止

Do Not Use Abort Exit Getenv System 

OPT.CPP.MISRAC.DoNotUseAbortExitGetenvSystem 

DoNotUseAbortExitGetenvSystem:MISRA 20.11:ライブラリ「stdlib.h」の「abort、exit、getenv、system」関数の使用禁止

Do Not Use Errno 

OPT.CPP.MISRAC.DoNotUseErrno 

DoNotUseErrno:MISRA 20.5:エラーコード変数「errno」の使用禁止

Do Not Use Offsetof 

OPT.CPP.MISRAC.DoNotUseOffsetof 

DoNotUseOffsetof:MISRA 20.6:「stddef.h」のマクロ「offsetof」の使用禁止

Do Not Use Underlying Bit Rep Of Float 

OPT.CPP.MISRAC.DoNotUseUnderlyingBitRepOfFloat 

DoNotUseUnderlyingBitRepOfFloat:MISRA 12.12:浮動小数点の基になるビット表現の使用禁止

Document Pragma Directives 

OPT.CPP.MISRAC.DocumentPragmaDirectives 

DocumentPragmaDirectives:MISRA 3.4:「#pragma」ディレクティブのすべての使用方法について説明文が必要

Encapsulate Assembly 

OPT.CPP.MISRAC.EncapsulateAssembly 

EncapsulateAssembly:MISRA 2.1:アセンブリ言語はカプセル化し分離することが必要

Evaluation Order Independence 

OPT.CPP.MISRAC.EvaluationOrderIndependence 

EvaluationOrderIndependence:MISRA 12.2:式の値は標準で許可されている評価の順序に関係なく同じになることが必要

Float Implicit Conversions 

OPT.CPP.MISRAC.FloatImplicitConversions 

FloatImplicitConversions:MISRA 10.2:浮動小数点型の式の値は、暗黙のうちに異なる型に変換することは禁止

For Control Expression With Float Objects 

OPT.CPP.MISRAC.ForControlExpressionWithFloatObjects 

ForControlExpressionWithFloatObjects:MISRA 13.4:for文の制御式には浮動小数点のオブジェクトの使用は禁止

For Loop Expressions For Loop Control 

OPT.CPP.MISRAC.ForLoopExpressionsForLoopControl 

ForLoopExpressionsForLoopControl:MISRA 13.5:for文の3つの式は、ループ制御のみに使用

Functions Should Have Single Return At End 

OPT.CPP.MISRAC.FunctionsShouldHaveSingleReturnAtEnd 

FunctionsShouldHaveSingleReturnAtEnd:MISRA 14.7:関数はその最後に1つだけの終了点を持つことが必要

Identifiers Must Not Hide Outer Definitions 

OPT.CPP.MISRAC.IdentifiersMustNotHideOuterDefinitions 

IdentifiersMustNotHideOuterDefinitions:MISRA 5.2:内部スコープの識別子は同じ名前を再利用して外部スコープの識別子を隠すことは禁止

Integer Implicit Conversions 

OPT.CPP.MISRAC.IntegerImplicitConversions 

IntegerImplicitConversions:MISRA 10.1:整数型の式の値は、暗黙のうちに異なる型に変換することは禁止

Macro Expansion Check 

OPT.CPP.MISRAC.MacroExpansionCheck 

MacroExpansionCheck:MISRA 19.4:Cのマクロは安全な構文にのみ展開することが必要

Name Parameters In Function Prototypes 

OPT.CPP.MISRAC.NameParametersInFunctionPrototypes 

NameParametersInFunctionPrototypes:MISRA 16.3:関数プロトタイプのすべてのパラメータに名前を付けることが必要

Object Pointer Casts 

OPT.CPP.MISRAC.ObjectPointerCasts 

ObjectPointerCasts:MISRA 11.2:オブジェクトへのポインターと整数型以外の型、オブジェクト型への別のポインター、または「void」へのポインターとの間で変換の実行禁止

Proper Cast Complex Float Expression 

OPT.CPP.MISRAC.ProperCastComplexFloatExpression 

ProperCastComplexFloatExpression:MISRA 10.4:浮動小数点型の複合式の値は、より狭いか同じサイズの浮動小数点型にのみキャストすることが必要

Proper Cast Complex Integer Expression 

OPT.CPP.MISRAC.ProperCastComplexIntegerExpression 

ProperCastComplexIntegerExpression:MISRA 10.3:整数型の複雑な式の値は、式の基になる型よりも精度が低い同じ符号型の型にのみにキャストすることが必要

Same Function Declaration And Definition 

OPT.CPP.MISRAC.SameFunctionDeclarationAndDefinition 

SameFunctionDeclarationAndDefinition:MISRA 8.3:各関数のパラメータについて、宣言と定義における型は同一でなければならず、戻り値の型も同一であることが必要

Sizeof Expr With Side Effects 

OPT.CPP.MISRAC.SizeofExprWithSideEffects 

SizeofExprWithSideEffects:MISRA 12.3:「sizeof」演算子は、副作用を含む式では使用禁止

Switch With Default 

OPT.CPP.MISRAC.SwitchWithDefault 

SwitchWithDefault:MISRA 15.3:default句のないswitch文の回避

Switch Without Case Should Be Refactored 

OPT.CPP.MISRAC.SwitchWithoutCaseShouldBeRefactored 

SwitchWithoutCaseShouldBeRefactored:MISRA 15.5:case句のないswitch文は作り直すことが必要

Tag Unique Identifier 

OPT.CPP.MISRAC.TagUniqueIdentifier 

TagUniqueIdentifier:MISRA 5.4:タグ名は一意な識別子であることが必要

Typedef Unique Identifier 

OPT.CPP.MISRAC.TypedefUniqueIdentifier 

TypedefUniqueIdentifier:MISRA 5.3:「typedef」名は一意の識別子であることが必要

Unsigned Bitwise Operands 

OPT.CPP.MISRAC.UnsignedBitwiseOperands 

UnsignedBitwiseOperands:MISRA 12.7:ビット演算子は、基になる型が符号付きであるオペランドには使用禁止

Num Max Class By Namespace 

OPT.CPP.NumMaxClassByNamespace 

NumMaxClassByNamespaces:パッケージ/名前空間ごとの過剰なクラス数の回避

Remove Unused Param 

OPT.CPP.RemoveUnusedParam 

RemoveUnusedParam:関数内の未使用のパラメータは削除

Avoid Inline Constructor And Destructor 

OPT.CPP.AvoidInlineConstructorAndDestructor 

AvoidInlineConstructorAndDestructor:インラインコンストラクタとデストラクタの宣言の回避

Constant Member Functions 

OPT.CPP.ConstantMemberFunctions 

ConstantMemberFunctions:状態を変更しないメンバ関数は定数宣言されることが必要

Dont Use Cast 

OPT.CPP.DontUseCast 

DontUseCast:C++のキャスト演算子を除き、明示的な型変換(キャスト)は使用禁止

No Specify Member Data In Class 

OPT.CPP.NoSpecifyMemberDataInClass 

NoSpecifyMemberDataInClass:クラスでpublicまたはprotectedメンバデータの指定禁止

Non Constant Reference From Function 

OPT.CPP.NonConstantReferenceFromFunction 

NonConstantReferenceFromFunction:public関数からの非const参照

Potential Infinite Loop

OPT.CPP.PotentialInfiniteLoop 

PotentialInfiniteLoop:到達不可能な終了条件を持つルール(無限ループ)

Too Many Constructors 

OPT.CPP.TooManyConstructors 

TooManyConstructors:コンストラクタの多すぎるクラスの回避

Too Many Data Members 

OPT.CPP.TooManyDataMembers 

TooManyDataMembers:データメンバーが多すぎるクラスの回避

Too Many Methods 

OPT.CPP.TooManyMethods 

TooManyMethods:メソッドが多すぎるクラスの回避

Obsolete Function 

OPT.CPP.PORT.ObsoleteFunction 

ObsoleteFunction:非推奨または廃止された関数の使用禁止

Hardcoded Username Password

OPT.CPP.SEC.HardcodedUsernamePassword 

HardcodedUsernamePassword:ハードコードされた資格情報の使用

Insecure Randomness

OPT.CPP.SEC.InsecureRandomness 

InsecureRandomnes:安全でない標準的な擬似乱数生成器