Skip to content

Repo sync for protected CLA branch #4204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/code-quality/c1250.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
description: "Learn more about: C1250"
title: C1250
ms.date: 11/04/2016
description: "Learn more about: Fatal error C1250"
title: Fatal error C1250
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C1250"]
f1_keywords: ["C1250", "FATALERROR_UnableToLoadPlugin"]
helpviewer_keywords: ["C1250"]
ms.assetid: 3f2385d7-e0d6-4574-8cea-342e82d0aea4
---
# C1250
# Fatal error C1250

> warning C1250: Unable to load plug-in.
> Unable to load plug-in '*plugin-name*'.

The Code Analysis tool reports this warning when there is an internal error in the plugin, not in the code being analyzed.
The Code Analysis tool reports this error when there's an internal error in the plugin, not in the code being analyzed.
14 changes: 8 additions & 6 deletions docs/code-quality/c1251.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
description: "Learn more about: C1251"
title: C1251
ms.date: 11/04/2016
description: "Learn more about: Fatal error C1251"
title: Fatal error C1251
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C1251", "FATALERROR_UnableToLoadModel"]
helpviewer_keywords: ["C1251"]
ms.assetid: 0b46e0a5-c290-48d8-ba4e-f526ae68993b
---
# C1251
# Fatal error C1251

> warning C1251: Unable to load models.
> Unable to load models.

The Code Analysis tool reports this warning when there is an internal error in the model file, not in the code being analyzed.
The Code Analysis tool reports this error when there's an internal error in the model file, not in the code being analyzed.
14 changes: 7 additions & 7 deletions docs/code-quality/c1252.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
description: "Learn more about: C1252"
title: C1252
ms.date: 06/01/2022
description: "Learn more about: Fatal error C1252"
title: Fatal error C1252
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C1252"]
f1_keywords: ["C1252", "FATALERROR_CircularDependency"]
helpviewer_keywords: ["C1252"]
ms.assetid: e88bf199-890d-4582-bb5c-c1238797145b
---
# C1252
# Fatal error C1252

> warning C1252: Circular or missing dependency between plugins: '*plugin-name*' requires GUID '*globally-unique-identifier*'
> Circular or missing dependency between plugins: '*plugin-name*' requires GUID '*globally-unique-identifier*'

The Code Analysis tool reports this warning when there's an internal error in the plugin dependencies. It's not caused by an issue in the code being analyzed.
The Code Analysis tool reports this error when there's an internal error in the plugin dependencies. It's not caused by an issue in the code being analyzed.

In some cases, it's possible to work around this issue by disabling the **Enable Code Analysis on Build** property. To disable this build property, open the Property pages dialog for your project. In the **Solution Explorer** window, right-click on the project (not the solution) and select **Properties** in the shortcut menu. Set the **Configuration** to **All Configurations** and the **Platform** to **All Platforms**. Open the **Configuration Properties** > **Code Analysis** > **General** property page. Modify the **Enable Code Analysis on Build** property to **No**. Choose **OK** to save your changes, and then save your project files. Rebuild your project to verify that the issue no longer occurs.

Expand Down
14 changes: 7 additions & 7 deletions docs/code-quality/c1253.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
description: "Learn more about: C1253"
title: C1253
ms.date: 11/04/2016
description: "Learn more about: Fatal error C1253"
title: Fatal error C1253
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C1253"]
f1_keywords: ["C1253", "FATALERROR_UnableToLoadModelFile"]
helpviewer_keywords: ["C1253"]
ms.assetid: 21a4062f-fde8-40e5-8dbd-6f892926d3d2
---
# C1253
# Fatal error C1253

> warning C1253: Unable to load model file.
> Unable to load model file.

The Code Analysis tool reports this warning when there is an internal error in the model file, not in the code being analyzed.
The Code Analysis tool reports this error when there's an internal error in the model file, not in the code being analyzed.
14 changes: 7 additions & 7 deletions docs/code-quality/c1254.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
description: "Learn more about: C1254"
title: C1254
ms.date: 11/04/2016
description: "Learn more about: Fatal error C1254"
title: Fatal error C1254
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C1254"]
f1_keywords: ["C1254", "FATALERROR_PluginVersionMismatch"]
helpviewer_keywords: ["C1254"]
ms.assetid: cb1377cf-869e-432d-941f-71f77134f97a
---
# C1254
# Fatal error C1254

> warning C1254: Plugin version mismatch : version doesn't match the version of the PREfast driver
> Plugin version mismatch: '*module*' version '*version-number*' doesn't match the version '*version-number*' of the PREfast driver

The Code Analysis tool reports this warning when there is an internal error with the plugin version, not in the code being analyzed.
The Code Analysis tool reports this error when there's an internal error with the plugin version, not in the code being analyzed.
14 changes: 7 additions & 7 deletions docs/code-quality/c1255.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
description: "Learn more about: C1255"
title: C1255
ms.date: 11/04/2016
description: "Learn more about: Fatal error C1255"
title: Fatal error C1255
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C1255"]
f1_keywords: ["C1255", "FATALERROR_PCHSyncLost"]
helpviewer_keywords: ["C1255"]
ms.assetid: a97da6bd-06dc-42bf-9158-0de1ebb90d4a
---
# C1255
# Fatal error C1255

> warning C1255: PCH data for plugin has incorrect length.
> PCH data for plugin '*plugin-name*' has incorrect length.

The Code Analysis tool reports this warning when there is an internal error in the tool, not in the code being analyzed.
The Code Analysis tool reports this error when there's an internal error in the tool, not in the code being analyzed.
14 changes: 7 additions & 7 deletions docs/code-quality/c1256.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
description: "Learn more about: C1256"
title: C1256
ms.date: 11/04/2016
description: "Learn more about: Fatal error C1256"
title: Fatal error C1256
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C1256"]
f1_keywords: ["C1256", "FATALERROR_PCHInconsistent"]
helpviewer_keywords: ["C1256"]
ms.assetid: 4d65e495-f9d9-435c-ba51-1cf5b4cc2309
---
# C1256
# Fatal error C1256

> warning C1256: PCH must be both written and read.
> '*plugin-name*': PCH must be both written and read.

The Code Analysis tool reports this warning when there is an internal error in the tool, not in the code being analyzed.
The Code Analysis tool reports this error when there's an internal error in the tool, not in the code being analyzed.
14 changes: 7 additions & 7 deletions docs/code-quality/c1257.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
description: "Learn more about: C1257"
title: C1257
ms.date: 11/04/2016
description: "Learn more about: Fatal error C1257"
title: Fatal error C1257
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C1257"]
f1_keywords: ["C1257", "FATALERROR_InitFailure"]
helpviewer_keywords: ["C1257"]
ms.assetid: 38d3ec05-01ba-42b3-aac6-077e92bf2ded
---
# C1257
# Fatal error C1257

> warning C1257: Plugin Initialization Failure.
> '*Plugin-name*': Initialization Failure.

The Code Analysis tool reports this warning when there is an internal error in the plugin, not in the code being analyzed.
The Code Analysis tool reports this error when there's an internal error in the plugin, not in the code being analyzed.
13 changes: 13 additions & 0 deletions docs/code-quality/c1258.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
description: "Learn more about: Fatal error C1258"
title: Fatal error C1258
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C1258", "FATALERROR_SaveToXmlFailed"]
helpviewer_keywords: ["C1258"]
---
# Fatal error C1258

> Failed to save XML Log file '*filename*'. *Message*.

The Code Analysis tool reports this error when there's an internal error in the plugin, not in the code being analyzed.
13 changes: 13 additions & 0 deletions docs/code-quality/c1259.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
description: "Learn more about: Fatal error C1259"
title: Fatal error C1259
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C1259", "FATALERROR_FatalError"]
helpviewer_keywords: ["C1259"]
---
# Fatal error C1259

> A fatal error was issued by a plugin.

The Code Analysis tool reports this error when there's an internal error in the plugin, not in the code being analyzed.
13 changes: 13 additions & 0 deletions docs/code-quality/c1260.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
description: "Learn more about: Fatal error C1260"
title: Fatal error C1260
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C1260", "FATALERROR_DuplicateId"]
helpviewer_keywords: ["C1260"]
---
# Fatal error C1260

> The plugins '*plugin-1*' and '*plugin-2*' share the same id. It is not supported to load the same plugin twice.

The Code Analysis tool reports this error when there's an internal error in the plugin, not in the code being analyzed.
18 changes: 11 additions & 7 deletions docs/code-quality/c6001.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
---
description: "Learn more about: C6001"
title: C6001
ms.date: 11/04/2016
description: "Learn more about: Warning C6001"
title: Warning C6001
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C6001"]
f1_keywords: ["C6001", "USING_UNINIT_VAR", "__WARNING_USING_UNINIT_VAR"]
helpviewer_keywords: ["C6001"]
ms.assetid: 55e779f1-7295-48f7-8ce1-b43898b36cd8
---
# C6001
# Warning C6001

> warning C6001: using uninitialized memory \<variable>
> Using uninitialized memory '*variable*'.

This warning is reported when an uninitialized local variable is used before it is assigned a value. This could lead to unpredictable results. You should always initialize variables before use.
## Remarks

This warning is reported when an uninitialized local variable is used before it's assigned a value. This usage could lead to unpredictable results. You should always initialize variables before use.

Code analysis name: `USING_UNINIT_VAR`

## Example

Expand Down
22 changes: 13 additions & 9 deletions docs/code-quality/c6011.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
---
title: C6011
title: Warning C6011
description: "Reference for Visual Studio C++ code analysis warning C6011."
ms.date: 03/23/2020
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C6011"]
f1_keywords: ["C6011", "DEREF_NULL_PTR", "__WARNING_DEREF_NULL_PTR"]
helpviewer_keywords: ["C6011"]
ms.assetid: 54b7bc2b-b8f5-43fc-a9a3-8189b03f249a
---
# C6011
# Warning C6011

> warning C6011: dereferencing NULL pointer \<name>
> Dereferencing NULL pointer '*pointer-name*'.

## Remarks

This warning indicates that your code dereferences a potentially null pointer. If the pointer value is invalid, the result is undefined. To resolve the issue, validate the pointer before use.

Code analysis name: `DEREF_NULL_PTR`

## Example

The following code generates this warning because a call to `malloc` might return null if insufficient memory is available:
Expand Down Expand Up @@ -59,12 +63,12 @@ void f([Pre(Null=Yes)] char* pc)
}
```

The careless use of `malloc` and `free` leads to memory leaks and exceptions. To minimize these kinds of leaks and exception problems altogether, avoid allocating raw memory yourself. Instead, use the mechanisms provided by the C++ Standard Library (STL). These include [shared_ptr](../standard-library/shared-ptr-class.md), [unique_ptr](../standard-library/unique-ptr-class.md), and [vector](../standard-library/vector.md). For more information, see [Smart Pointers](../cpp/smart-pointers-modern-cpp.md) and [C++ Standard Library](../standard-library/cpp-standard-library-reference.md).
The careless use of `malloc` and `free` leads to memory leaks and exceptions. To minimize these kinds of leaks and exception problems altogether, avoid allocating raw memory yourself. Instead, use the mechanisms provided by the C++ Standard Library (STL). These include [`shared_ptr`](../standard-library/shared-ptr-class.md), [`unique_ptr`](../standard-library/unique-ptr-class.md), and [`vector`](../standard-library/vector.md). For more information, see [Smart Pointers](../cpp/smart-pointers-modern-cpp.md) and [C++ Standard Library](../standard-library/cpp-standard-library-reference.md).

## See also

- [Using SAL Annotations to reduce code defects](using-sal-annotations-to-reduce-c-cpp-code-defects.md)
- [NULL](../c-runtime-library/null-crt.md)
- [`NULL`](../c-runtime-library/null-crt.md)
- [Indirection and Address-of Operators](../c-language/indirection-and-address-of-operators.md)
- [malloc](../c-runtime-library/reference/malloc.md)
- [free](../c-runtime-library/reference/free.md)
- [`malloc`](../c-runtime-library/reference/malloc.md)
- [`free`](../c-runtime-library/reference/free.md)
12 changes: 7 additions & 5 deletions docs/code-quality/c6014.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@ ms.assetid: ef76ec88-74d2-4a3b-b6fe-4b0851ab3372
---
# Warning C6014

> warning C6014: Leaking memory.
> Leaking memory '*pointer-name*'.

This warning indicates that the specified pointer points to allocated memory or some other allocated resource that hasn't been freed.

## Remarks

The analyzer checks for this condition only when the `_Analysis_mode_(_Analysis_local_leak_checks_)` SAL annotation is specified. By default, this annotation is specified for Windows kernel mode (driver) code. For more information about SAL annotations, see [Using SAL Annotations to Reduce C/C++ Code Defects](../code-quality/using-sal-annotations-to-reduce-c-cpp-code-defects.md).

This warning is reported for both memory and resource leaks when the resource is commonly *aliased* to another location. Memory is aliased when a pointer to the memory escapes the function by using an `_Out_` parameter annotation, global variable, or return value. This warning can be reported on function exit if the argument is annotated that its release is expected.

Code Analysis won't recognize the actual implementation of a memory allocator (involving address arithmetic) and won't recognize that memory is allocated (although many wrappers will be recognized). In this case, the analyzer doesn't recognize that the memory was allocated and issues this warning. To suppress the false positive, use a `#pragma warning(disable: 6014)` directive on the line that precedes the opening brace `{` of the function body.

Code analysis name: `MEMORY_LEAK`

## Examples

The following code generates warning C6014:
Expand Down Expand Up @@ -76,10 +82,6 @@ int main( )
}
```

This warning is reported for both memory and resource leaks when the resource is commonly *aliased* to another location. Memory is aliased when a pointer to the memory escapes the function by using an `_Out_` parameter annotation, global variable, or return value. This warning can be reported on function exit if the argument is annotated that its release is expected.

Code Analysis won't recognize the actual implementation of a memory allocator (involving address arithmetic) and won't recognize that memory is allocated (although many wrappers will be recognized). In this case, the analyzer doesn't recognize that the memory was allocated and issues this warning. To suppress the false positive, use a `#pragma` directive on the line that precedes the opening brace `{` of the function body.

To avoid these kinds of potential leaks altogether, use the mechanisms that are provided by the C++ Standard Library (STL). These include [`shared_ptr`](../standard-library/shared-ptr-class.md), [`unique_ptr`](../standard-library/unique-ptr-class.md), and containers such as [`vector`](../standard-library/vector.md). For more information, see [Smart pointers](../cpp/smart-pointers-modern-cpp.md) and [C++ Standard Library](../standard-library/cpp-standard-library-reference.md).

```cpp
Expand Down
22 changes: 13 additions & 9 deletions docs/code-quality/c6029.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
---
description: "Learn more about: C6029"
title: C6029
ms.date: 11/04/2016
description: "Learn more about: Warning C6029"
title: Warning C6029
ms.date: 10/04/2022
ms.topic: reference
f1_keywords: ["C6029"]
f1_keywords: ["C6029", "USING_TAINTED_DATA", "__WARNING_USING_TAINTED_DATA"]
helpviewer_keywords: ["C6029"]
ms.assetid: 07f89261-1b77-4597-9f34-12ce5d569b60
---
# C6029
# Warning C6029

> warning C6029: possible buffer overrun in call to \<function>: use of unchecked value
> Possible buffer overrun in call to '*function*': use of unchecked value

This warning indicates that a function that takes a buffer and a size is being passed a unchecked size. The data read-in from some external source has not been verified to see whether it is smaller than the buffer size. An attacker might intentionally specify a much larger than expected value for the size, which will lead to a buffer overrun.
## Remarks

Generally, whenever you read data from an untrusted external source, make sure to verify it for validity. It is usually appropriate to verify the size to make sure it is in the expected range.
This warning indicates that a function that takes a buffer and a size is being passed an unchecked size. The data read-in from some external source hasn't been verified to see whether it's smaller than the buffer size. An attacker might intentionally specify a much larger than expected value for the size, which will lead to a buffer overrun.

Generally, whenever you read data from an untrusted external source, make sure to verify it for validity. It's appropriate to verify the size to make sure it's in the expected range.

Code analysis name: `USING_TAINTED_DATA`

## Example

The following code generates this warning by calling the annotated function [ReadFile](/windows/desktop/api/fileapi/nf-fileapi-readfile) two times. After the first call, the Post attribute property marks the second parameter value untrusted. Therefore, passing an untrusted value in the second call to `ReadFile` generates this warning as shown in the following code:
The following code generates this warning by calling the annotated function [`ReadFile`](/windows/desktop/api/fileapi/nf-fileapi-readfile) two times. After the first call, the Post attribute property marks the second parameter value untrusted. Therefore, passing an untrusted value in the second call to `ReadFile` generates this warning as shown in the following code:

```cpp

Expand Down
Loading