Code Analysis for C/C++ Warnings
This section lists C/C++ Code Analysis warnings in the range of C6000 to C6999.
In This Section
Warning Number |
Description |
---|---|
warning C6001: using uninitialized memory <variable> |
|
warning C6011: dereferencing NULL pointer <name> |
|
warning C6029: possible buffer overrun in call to <function>: use of unchecked value |
|
warning C6031: return value ignored: <function> could return unexpected value |
|
warning C6053: call to <function> may not zero-terminate string <variable> |
|
warning C6054: string <variable> may not be zero-terminated |
|
warning C6057: buffer overrun due to number of characters/number of bytes mismatch in call to <function> |
|
warning C6059: Incorrect length parameter in call to <function>. Pass the number of remaining characters, not the buffer size of <variable> |
|
warning C6063: missing string argument to <function> corresponding to conversion specifier <number> |
|
warning C6064: missing integer argument to <function> corresponding to conversion specifier <number> |
|
warning C6066: non-pointer passed as parameter <number> when pointer is required in call to <function> |
|
warning C6067: parameter <number> in call to <function> must be the address of the string |
|
warning C6200: index <name> is out of valid index range <min> to <max> for non-stack buffer <variable> |
|
warning C6201: buffer overrun for <variable>, which is possibly stack allocated: index <name> is out of valid index range <min> to <max> |
|
warning C6202: buffer overrun for <variable>, which is possibly stack allocated, in call to <function>: length <size> exceeds buffer size <max> |
|
warning C6203: buffer overrun for buffer <variable> in call to <function>: length <size> exceeds buffer size |
|
warning C6204: possible buffer overrun in call to <function>: use of unchecked parameter <variable> |
|
warning C6209: using 'sizeof<variable1>' as parameter <number> in call to <function> where <variable2> may be an array of wide characters, did you intend to use character count rather than byte count? |
|
warning C6211: Leaking memory <pointer> due to an exception. Consider using a local catch block to clean up memory |
|
warning C6214: cast between semantically different integer types: HRESULT to a Boolean type |
|
warning C6215: cast between semantically different integer types: a Boolean type to HRESULT |
|
warning C6216: compiler-inserted cast between semantically different integral types: a Boolean type to HRESULT |
|
warning C6217: Implicit cast between semantically different integer types: testing HRESULT with 'not'. Consider using SUCCEEDED or FAILED macro instead |
|
warning C6219: Implicit cast between semantically different integer types: comparing HRESULT to 1 or TRUE. Consider using SUCCEEDED or FAILED macro instead |
|
warning C6220 - Implicit cast between semantically different integer types: comparing HRESULT to -1. Consider using SUCCEEDED or FAILED macro instead |
|
warning C6221: Implicit cast between semantically different integer types: comparing HRESULT to an integer. Consider using SUCCEEDED or FAILED macros instead |
|
warning C6225: Implicit cast between semantically different integer types: assigning 1 or TRUE to HRESULT. Consider using S_FALSE instead |
|
warning C6226: Implicit cast between semantically different integer types: assigning -1 to HRESULT. Consider using E_FAIL instead |
|
warning C6230: implicit cast between semantically different integer types: using HRESULT in a Boolean context |
|
warning C6235: (<non-zero constant> || <expression>) is always a non-zero constant |
|
warning C6236: (<expression> || <non-zero constant>) is always a non-zero constant |
|
warning C6237: (<zero> && <expression>) is always zero. <expression> is never evaluated and may have side effects |
|
warning C6239: (<non-zero constant> && <expression>) always evaluates to the result of <expression>. Did you intend to use the bitwise-and operator? |
|
warning C6240: (<expression> && <non-zero constant>) always evaluates to the result of <expression>. Did you intend to use the bitwise-and operator? |
|
warning C6242: A jump out of this try-block forces local unwind. Incurs severe performance penalty |
|
warning C6244: local declaration of <variable> hides previous declaration at <line> of <file> |
|
warning C6246: Local declaration of <variable> hides declaration of same name in outer scope. Additional Information: See previous declaration at <location>. |
|
warning C6248: setting a SECURITY_DESCRIPTOR’s DACL to NULL will result in an unprotected object |
|
warning C6250: Calling <function> VirtualFree without the MEM_RELEASE flag may free memory but not address descriptors (VADs); results in address space leaks |
|
warning C6255: _alloca indicates failure by raising a stack overflow exception. Consider using _alloca_s instead |
|
warning C6258: using TerminateThread does not allow proper thread clean up |
|
warning C6259: labeled code is unreachable: (<expression> & <constant>) in switch-expr cannot evaluate to <case-label> |
|
warning C6260: sizeof * sizeof is almost always wrong, did you intend to use a character count or a byte count? |
|
warning C6262: Function uses <constant> bytes of stack: exceeds /analyze:stacksize<constant>. Consider moving some data to heap |
|
warning C6263: using _alloca in a loop; this can quickly overflow stack |
|
warning C6268: Incorrect order of operations: (<TYPE1>)(<TYPE2>)x + y. Possible missing parentheses in (<TYPE1>)((<TYPE2>)x + y) |
|
warning C6269: possible incorrect order of operations: dereference ignored |
|
warning C6270: missing float argument to <function>: add a float argument corresponding to conversion specifier <number> |
|
warning C6271: extra argument passed to <function>: parameter <number> is not used by the format string |
|
warning C6272: non-float passed as argument <number> when float is required in call to <function> |
|
warning 6273 - non-integer passed as parameter <number> when integer is required in call to <function>: if a pointer value is being passed, %p should be used |
|
warning C6274: non-character passed as parameter <number> when character is required in call to <function> |
|
warning C6276: Cast between semantically different string types: char* to wchar_t*. Use of invalid string can lead to undefined behavior |
|
warning C6277: NULL application name with an unquoted path in call to <function>: results in a security vulnerability if the path contains spaces |
|
warning C6278: <variable> is allocated with array new [], but deleted with scalar delete. Destructors will not be called |
|
warning C6279: <variable> is allocated with scalar new, deleted with array delete [] |
|
warning C6280: <variable> is allocated with <function>, but deleted with <function> |
|
warning 6281 - incorrect order of operations: relational operators have higher precedence than bitwise operators |
|
warning C6282: Incorrect operator: assignment of constant in Boolean context. Consider using '==' instead |
|
warning C6283: <variable> is allocated with array new [], but deleted with scalar delete |
|
warning C6284: object passed as parameter '%d' when string is required in call to <function>. |
|
warning C6285: (<non-zero constant> || <non-zero constant>) is always a non-zero constant. Did you intend to use the bitwise-and operator? |
|
warning C6286: (<non-zero constant> || <expression>) is always a non-zero constant. <expression> is never evaluated and may have side effects |
|
warning C6287: redundant code: the left and right sub-expressions are identical |
|
warning C6288: Incorrect operator: mutual inclusion over && is always zero. Did you intent to use || instead? |
|
warning C6289: Incorrect operator: mutual exclusion over || is always a non-zero constant. Did you intend to use && instead? |
|
warning C6290: Bitwise operation on logical result: ! has higher precedence than &. Use && or (!(x & y)) instead |
|
warning C6291: Bitwise operation on logical result: ! has higher precedence than |. Use || or (!(x | y)) instead |
|
warning C6292: ill-defined for-loop: counts up from maximum |
|
warning C6293: Ill-defined for-loop: counts down from minimum |
|
warning C6294: Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed |
|
warning C6295: Ill-defined for-loop: <variable> values are of the range "min" to "max". Loop executed indefinitely |
|
warning C6296: Ill-defined for-loop: Loop body only executed once |
|
warning C6297: Arithmetic overflow: 32-bit value is shifted, then cast to 64-bit value. Result may not be an expected value |
|
warning C6298: using a read-only string <pointer> as a writable string argument: this will attempt to write into static read-only memory and cause random crashes |
|
warning C6299: explicitly comparing a bit field to a Boolean type will yield unexpected results |
|
warning C6302: format string mismatch: character string passed as parameter <number> when wide character string is required in call to <function>s |
|
warning C6303: format string mismatch: wide character string passed as parameter <number> when character string is required in call to <function> |
|
warning C6305: potential mismatch between sizeof and countof quantities |
|
warning C6306: incorrect call to <function>: consider using <function> which accepts a va_list as an argument |
|
warning C6308: 'realloc' may return null pointer: assigning a null pointer to <variable>, which is passed as an argument to 'realloc', will cause the original memory block to be leaked |
|
warning C6309: argument <number> is null: it does not adhere to function specification of <function> |
|
warning C6310: illegal constant in exception filter can cause unexpected behavior |
|
warning C6312: Possible infinite loop: use of the constant EXCEPTION_CONTINUE_EXECUTION in the exception-filter expression of a try-except |
|
warning C6313: Incorrect operator: Zero-valued flag cannot be tested with bitwise-and. Use an equality test to look for zero-valued flags |
|
warning C6314: Incorrect order of operations: bitwise-or has higher precedence than the conditional-expression operator. Add parentheses to clarify intent |
|
warning C6315: Incorrect order of operations: bitwise-and has higher precedence than bitwise-or. Add parentheses to clarify intent |
|
warning C6316: Incorrect operator: tested expression is constant and non-zero. Use bitwise-and to determine whether bits are set |
|
warning C6317: incorrect operator: logical-not (!) is not interchangeable with ones-complement (~) |
|
warning C6318: Ill-defined __try/__except: use of the constant EXCEPTION_CONTINUE_SEARCH or another constant that evaluates to zero in the exception-filter expression. The code in the exception handler block is not executed |
|
warning C6319: use of the comma-operator in a tested expression causes the left argument to be ignored when it has no side-effects |
|
warning C6320: exception-filter expression is the constant EXCEPTION_EXECUTE_HANDLER. This may mask exceptions that were not intended to be handled |
|
warning C6322: empty _except block |
|
warning 6323 - use of arithmetic operator on Boolean type(s) |
|
warning C6324: potential incorrect use of <function1>: Did you intend to use <function2>? |
|
warning C6326: potential comparison of a constant with another constant |
|
warning C6327: Potential buffer overrun: SysAllocStringLen copies <number> characters from the string <variable> without validating the number of characters to copy. The code may crash |
|
warning C6328:<type> passed as parameter <number> when <type> is required in call to <function> |
|
warning C6331: Invalid parameter: passing MEM_RELEASE and MEM_DECOMMIT in conjunction to <function> is not allowed. This results in the failure of this call |
|
warning C6332: Invalid parameter: passing zero as the dwFreeType parameter to <function> is not allowed. This results in the failure of this call |
|
warning C6333: Invalid parameter: passing MEM_RELEASE and a non-zero dwSize parameter to <function> is not allowed. This results in the failure of this call |
|
warning C6334: sizeof operator applied to an expression with an operator may yield unexpected results |
|
warning C6335: leaking process information handle <handlename> |
|
warning C6336: arithmetic operator has precedence over question operator, use parentheses to clarify intent |
|
warning C6381: Shutdown API <function> requires a valid dwReason or lpMessage |
|
warning C6383: buffer overrun due to conversion of an element count into a byte count: an element count is expected for parameter <number> in call to <function> |
|
warning C6384: dividing sizeof a pointer by another value |
|
warning C6385: invalid data: accessing <buffer name>, the readable size is <size1> bytes, but <size2> bytes may be read: Lines: x, y |
|
warning C6386: buffer overrun: accessing <buffer name>, the writable size is <size1> bytes, but <size2> bytes may be written: Lines: x, y |
|
warning C6387: <argument> may be <value>: this does not adhere to the specification for the function <function name>: Lines: x, y |
|
warning C6388: <argument> may not be <value>: this does not adhere to the specification for the function <function name>: Lines: x, y |
|
warning C6400: Using <function name> to perform a case-insensitive compare to constant string <string name>. Yields unexpected results in non-English locales |
|
warning C6401: Using <function name> in a default locale to perform a case-insensitive compare to constant string < string name>. Yields unexpected results in non-English locales |
|
warning C6500: invalid annotation: value for <name> property is invalid |
|
warning C6501: annotation conflict: <name> property conflicts with previously specified property |
|
warning C6503: annotation conflict: references may not be marked Null=Yes or Null=Maybe |
|
warning C6504: invalid annotation: property may only be used on values of pointer, pointer-to-member, or array type |
|
warning C6505: invalid annotation: MustCheck property may not be used on values of void type |
|
warning C6506: invalid annotation: <name> property may only be used on values of pointer or array types |
|
warning C6507: annotation conflict: Null property at Deref=0 on a post condition must be a subset of the Null property on the precondition |
|
warning C6508: invalid annotation: write access is not allowed on const values |
|
warning C6509: invalid annotation: 'return' cannot be referenced from a precondition |
|
warning C6510: invalid annotation: NullTerminated property may only be used on values of pointer or array type |
|
warning C6511: invalid annotation: MustCheck property must be Yes or No |
|
warning C6512: invalid annotation: Null property must be Maybe if the Valid property is No |
|
warning C6513: invalid annotation: ElementSizeConst requires additional size properties |
|
warning C6514: invalid annotation: value of the <name> property exceeds the size of the array |
|
warning C6515 - invalid annotation: <name> property may only be used on values of pointer type |
|
warning C6516: invalid annotation: no properties specified for <name> attribute |
|
warning C6517: annotation conflict: ValidElementsConst and ValidBytesConst may not be specified on the buffers that are not readable |
|
warning C6518: annotation conflict: WriteableElementsConst and WriteableBytesConst may not be specified on buffers that are not writable |
|
warning C6521: invalid size specification: * operator can only be applied to pointer types |
|
warning C6522: invalid size specification: expression must be of integral type |
|
warning C6523: invalid size specification: parameter <name> not found |
|
warning C6525: invalid size specification: property value may not be valid |
|
warning C6526 - invalid size specification: expression must be of array or pointer type |
|
warning 6530: unrecognized format string style <name> |
|
warning C6535: buffer cannot be of size <n>, bigger than max(size_t) |
See Also
Concepts
Guidelines for Writing Secure Code