Mixed Recommended Rules rule set
The Microsoft Mixed Recommended Rules focus on the most common and critical problems in your C++ projects that support the Common Language Runtime, including potential security holes, application crashes, and other important logic and design errors. You should include this rule set in any custom rule set you create for your C++ projects that support the Common Language Runtime. This ruleset is designed to be configured with the Visual Studio Professional edition and higher.
Rule |
Description |
---|---|
Using Uninitialized Memory |
|
Dereferencing Null Pointer |
|
Use Of Unchecked Value |
|
Return Value Ignored |
|
Zero Termination From Call |
|
Zero Termination Missing |
|
Bad Concatenation |
|
Missing String Argument To Format Function |
|
Missing Integer Argument To Format Function |
|
Missing Pointer Argument To Format Function |
|
Missing String Pointer Argument To Format Function |
|
Returning uninitialized memory |
|
Index Exceeds Buffer Maximum |
|
Index Exceeds Stack Buffer Maximum |
|
Invalid Cast HRESULT To BOOL |
|
Invalid Cast BOOL To HRESULT |
|
Invalid Compiler-Inserted Cast BOOL To HRESULT |
|
Invalid HRESULT Test With NOT |
|
Invalid HRESULT Compare To -1 |
|
Invalid HRESULT Assignment To -1 |
|
Invalid HRESULT Use As Boolean |
|
Non-Zero Constant With Logical-Or |
|
Logical-Or With Non-Zero Constant |
|
Zero With Logical-And Loses Side Effects |
|
Local Unwind Forced |
|
Creating Null DACL |
|
Unreleased Address Descriptors |
|
Unprotected Use Of Alloca |
|
Using Terminate Thread |
|
Dead Code In Bitwise-Or Limited Switch |
|
Use Of Byte Arithmetic |
|
Excessive Stack Usage |
|
Using Alloca In Loop |
|
Missing Parentheses In Cast |
|
Pointer Dereference Ignored |
|
Missing Float Argument To Format Function |
|
Extra Argument To Format Function |
|
Non-Float Argument To Format Function |
|
Non-Integer Argumen To Format Function |
|
Non-Character Argument To Format Function |
|
Invalid String Cast |
|
Invalid CreateProcess Call |
|
Array-New Scalar-Delete Mismatch |
|
Scalar-New Array-Delete Mismatch |
|
Memory Allocation-Deallocation Mismatch |
|
Bitwise Relation Precedence |
|
Assignment Replaces Test |
|
Primitive Array-New Scalar-Delete Mismatch |
|
Invalid Object Argument To Format Function |
|
Logical-Or Of Constants |
|
Non-Zero Logical-Or Losing Side Effects |
|
Redundant Test |
|
Mutual Inclusion Over Logical-And Is False |
|
Mutual Exclusion Over Logical-Or Is True |
|
Logical-Not Bitwise-And Precedence |
|
Logical-Not Bitwise-Or Precedence |
|
Loop Counts Up From Maximum |
|
Loop Counts Down From Minimum |
|
Loop Body Never Executed |
|
Infinite Loop |
|
Loop Only Executed Once |
|
Result Of Shift Cast To Larger Size |
|
Bitfield To Boolean Comparison |
|
Invalid Character String Argument To Format Function |
|
Invalid Wide Character String Argument To Format Function |
|
Mismatched Size And Count Use |
|
Incorrect Variable Argument Function Call |
|
Realloc Leak |
|
Illegal Exception Filter Constant |
|
Exception Continue Execution Loop |
|
Bitwise-Or Precedence |
|
Not Not Complement |
|
Exception Continue Search |
|
Ignored By Comma |
|
String Copy Instead Of String Compare |
|
Potential Argument Type Mismatch |
|
VirtualFree Invalid Flags |
|
VirtualFree Invalid Parameter |
|
VirtualFree Invalid Size |
|
Leaking Process Handle |
|
Shutdown Information Missing |
|
Element-Count Byte-Count Buffer Overrun |
|
Pointer Size Division |
|
Read Overrun |
|
Write Overrun |
|
Invalid Parameter Value |
|
Invalid Parameter Value |
|
Invalid Attribute Property |
|
Conflicting Attribute Property Values |
|
References Cannot Be Null |
|
Null On Non-Pointer |
|
MustCheck On Void |
|
Buffer Size On Non-Pointer Or Array |
|
Null Mismatch At Dereference Zero |
|
Write Access On Constant |
|
Return Used On Precondition |
|
Null Terminated On Non-Pointer |
|
MustCheck Must Be Yes Or No |
|
Element Size Without Buffer Size |
|
Buffer Size Exceeds Array Size |
|
Buffer Size On Non-Pointer |
|
No Properties On Attribute |
|
Valid Size On Non-Readable Buffer |
|
Writable Size On Non-Writable Buffer |
|
Invalid annotation: value of the 'NeedsRelease' property must be Yes or No |
|
Invalid Size String Dereference |
|
Invalid Size String Type |
|
Invalid Size String Parameter |
|
Invalid Size String Unreachable Location |
|
Invalid Size String Buffer Type |
|
Invalid annotation: 'NeedsRelease' property may not be used on values of void type |
|
Unrecognized Format String Style |
|
The use of attribute annotations on this function will invalidate all of its existing __declspec annotations |
|
Invalid size specification: expression not parsable |
|
Invalid Deref= or Notref=: expression not parsable |
|
The value is not a valid Yes/No/Maybe value |
|
The value is not a string value |
|
The value is not a number |
|
Unexpected Annotation Expression Error |
|
Expected number of arguments for annotation does not match actual number of arguments for annotation |
|
Unexpected Annotation Error for annotation |
|
Failed to save XML Log file |
|
Race condition |
|
Failing to use interlocked operation properly |
|
Caller failing to hold lock |
|
Caller failing to release lock |
|
Caller cannot hold any lock |
|
Failing to release lock |
|
Failing to acquire or to hold lock |
|
Releasing unheld lock |
|
Concurrency SAL annotation error |
|
The expression is not true at this call |
|
The parameter being annotated must be a pointer |
|
The function class(es) on this function do not match the function class(es) on the typedef used to define it. |
|
The function being assigned or passed should have a _Function_class_ annotation for at least one of the class(es) |
|
The function pointer being assigned to is annotated with the function class, which is not contained in the function class(es) list. |
|
The type of actual parameter should exactly match the type |
|
A variable which is accessed via an Interlocked function must always be accessed via an Interlocked function. |
|
Accessing a local variable via an Interlocked function |
|
The function must be called from within a try/except block |
|
The variable argument should instead be a (literal) constant |
|
The constant argument should instead be variable |
|
Consider using another function instead. |
|
Error annotation |
|
The function should never be called from within a try/except block |
|
The argument is being passed to a function that expects a pointer to an object (not a pointer to a pointer) |
|
Dereferencing NULL pointer. The pointer contains the same NULL value as another pointer did. |
|
The argument could be one value, and is a copy of the value found in the pointer |
|
The variable holds a value that must be examined |
|
The requirement is not satisfied. (The expression does not evaluate to true.) |
|
Illegal reference to non-static member |
|
Ambiguous reference to class member. |
|
_Success_ or _On_failure_ used in an illegal context |
|
Left operand points to a struct, use '->' |
|
Left operand is a struct, use '.' |
|
The declaration for symbol has a conflicting declaration |
|
Annotations for the __on_failure context must not be in explicit pre context |
|
Static context name expected for SAL_context |
|
Pointer expression expected for annotation |
|
The _Use_decl_annotations_ annotation must be used to reference, without modification, a prior declaration. |
|
Attribute parameter names must be p1...p9 |
|
The typefix cannot be applied to a parameter that already has a typefix |
|
The checkReturn annotation only applies to postconditions for the specific function parameter. |
|
For function, the number of parameters to annotation does not match that found at file |
|
For function paramteer, the annotation's parameter does not match that found at file |
|
Member of enumeration expected for annotation the parameter in the annotation |
|
Integer expression expected for annotation the parameter in the annotation |
|
String expression expected for the parameter in the annotation |
|
__yes, __no, or __maybe expected for annotation |
|
Did not find expected Token/identifier for annotation, parameter |
|
Annotation requires parameters |
|
Did not find the correct number of required parameters in annotation |
|
Annotation cannot also be a PrimOp (in current declaration) |
|
Annotation cannot also be a PrimOp (see prior declaration) |
|
Annotation parameter: cannot use type in annotations |
|
Annotation does not support parameters |
|
The type of parameter has no member. |
|
Annotation is only valid on array |
|
pre, post, or deref not applied to any annotation |
|
pre, post, or deref applied to a block |
|
__at expression does not apply to current function |
|
The function cannot stand alone as an annotation |
|
The annotation cannot be used in an expression |
|
The annotation on parameter is no longer supported |
|
The annotation on parameter has more than one of value, stringValue, and longValue. Use paramn=xxx |
|
The annotation on parameter has both value, stringValue, or longValue; and paramn=xxx. Use only paramn=xxx |
|
The annotation on parameter has param2 but no param1 |
|
The annotation for function on parameter is not recognized |
|
The annotation for function on parameter requires more dereferences than the actual type annotated allows |
|
The annotation for function has an unparseable parameter/external annotation |
|
The annotation for function annotates 'this' on a non-member-function |
|
The parameter annotation for function does not match the type of the parameter |
|
Inconsistent annotation for function: the prior instance has an error. |
|
Inconsistent annotation for function: this instance has an error. |
|
Inconsistent annotation for function: parameter has another annotations on this instance. |
|
Inconsistent annotation for function: parameter has another annotations on this instance. |
|
dynamic_cast<>() is not supported in annotations |
|
A syntax error in the annotation was found in function, for annotation |
|
A syntax error in a conditional annotation was found for Intrinsic annotation |
|
Result lists values must be constants. |
|
A syntax error in the annotations was found annotation in the function. |
|
The annotation for function, parameter when examining is inconsistent with the function declaration |
|
For function, the clues are inconsistent with the function declaration |
|
The parameter to _Macro_value_ is null |
|
For symbol, a 'begin' was found without a matching 'end' |
|
For symbol, an 'end' was found without a matching 'begin' |
|
Format Strings must be in preconditions |
|
For function, syntax error in parameter |
|
For function, syntax error near the end |
|
For function, syntax Error in _At_() annotation (unrecognized parameter name) |
|
For function, syntax Error in _At_() annotation (invalid parameter name) |
|
For function: ReadableTo or WritableTo did not have a limit-spec as a parameter |
|
the annotation for function contains more Externals than the actual number of parameters |
|
post null/notnull at deref level 0 is meaningless for function. |
|
Expression operands of incompatible types for operator |
|
No annotations for first declaration of function. |
|
An extra _Deref_ operator was found on annotation. |
|
An ambiguous _Deref_ operator was found on annotation. |
|
An improperly placed _Notref_ operator was found applied to token. |
|
An error while parsing a token was discovered. |
|
The annotation on parameter is obsolescent |
|
The annotation on parameter is obsolescent |
|
The annotation describes a situation that is not conditionally applicable. |
|
The annotation describes where a dynamic value (a variable) cannot be used in the condition. |
|
Types that own disposable fields should be disposable |
|
Declare event handlers correctly |
|
Mark assemblies with AssemblyVersionAttribute |
|
Interface methods should be callable by child types |
|
Types that own native resources should be disposable |
|
Move P/Invokes to NativeMethods class |
|
Do not hide base class methods |
|
Implement IDisposable correctly |
|
Do not raise exceptions in unexpected locations |
|
Avoid duplicate accelerators |
|
P/Invoke entry points should exist |
|
P/Invokes should not be visible |
|
Auto layout types should not be COM visible |
|
Call GetLastError immediately after P/Invoke |
|
COM visible type base types should be COM visible |
|
COM registration methods should be matched |
|
Declare P/Invokes correctly |
|
Remove empty finalizers |
|
Value type fields should be portable |
|
P/Invoke declarations should be portable |
|
Do not lock on objects with weak identity |
|
Review SQL queries for security vulnerabilities |
|
Specify marshaling for P/Invoke string arguments |
|
Review declarative security on value types |
|
Pointers should not be visible |
|
Secured types should not expose fields |
|
Method security should be a superset of type |
|
APTCA methods should only call APTCA methods |
|
APTCA types should only extend APTCA base types |
|
Do not indirectly expose methods with link demands |
|
Override link demands should be identical to base |
|
Wrap vulnerable finally clauses in outer try |
|
Type link demands require inheritance demands |
|
Security critical types may not participate in type equivalence |
|
Default constructors must be at least as critical as base type default constructors |
|
Delegates must bind to methods with consistent transparency |
|
Methods must keep consistent transparency when overriding base methods |
|
Transparent methods must contain only verifiable IL |
|
Transparent methods must not call methods with the SuppressUnmanagedCodeSecurity attribute |
|
Transparent code must not reference security critical items |
|
Transparent methods must not satisfy LinkDemands |
|
Types must be at least as critical as their base types and interfaces |
|
Transparent methods may not use security asserts |
|
Transparent methods must not call into native code |
|
Rethrow to preserve stack details |
|
Do not dispose objects multiple times |
|
Initialize value type static fields inline |
|
Do not mark serviced components with WebMethod |
|
Disposable fields should be disposed |
|
Do not call overridable methods in constructors |
|
Disposable types should declare finalizer |
|
Finalizers should call base class finalizer |
|
Implement serialization constructors |
|
Overload operator equals on overriding ValueType.Equals |
|
Mark Windows Forms entry points with STAThread |
|
Mark all non-serializable fields |
|
Call base class methods on ISerializable types |
|
Mark ISerializable types with SerializableAttribute |
|
Implement serialization methods correctly |
|
Implement ISerializable correctly |
|
Provide correct arguments to formatting methods |
|
Test for NaN correctly |