Skip to content

Commit 9d930f0

Browse files
eholkwesleywiser
andcommitted
Add heuristics for C6201
Also makes minor style fixes to make Acrolinx happier. Co-authored-by: Wesley Wiser <wesleywiser@microsoft.com>
1 parent 2b2a101 commit 9d930f0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/code-quality/c6201.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.assetid: eefbbd77-007c-4f28-95f6-6de5ee6a27db
1010

1111
> Index '*index-name*' is out of valid index range '*minimum*' to '*maximum*' for possibly stack allocated buffer '*variable*'
1212
13-
This warning indicates that an integer offset into the specified stack array exceeds the maximum bounds of that array. It may potentially cause stack overflow errors, random behavior, or crashes.
13+
This warning indicates that an integer offset into the specified stack array exceeds the maximum bounds of that array. It might potentially cause stack overflow errors, undefined behavior, or crashes.
1414

1515
## Remarks
1616

@@ -45,3 +45,9 @@ void f()
4545
}
4646
}
4747
```
48+
49+
## Heuristics
50+
51+
This analysis is limited to stack-allocated arrays. It doesn't consider, for example, arrays passed into the function with a SAL-annotated length.
52+
53+
This analysis can't catch all possible out of bounds indices because not all arithmetic can be precisely analyzed. It's tuned to report cases where it can guarantee an out of bounds index is possible. The absence of a warning doesn't mean the index is guaranteed to be in bounds.

0 commit comments

Comments
 (0)