Skip to content

Commit c047f24

Browse files
committed
Fix warnings.
1 parent 53f5fee commit c047f24

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

docs/code-quality/c26831.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ void foo(int i, int j)
2323
}
2424
```
2525
26-
In case `i+j` overflows, `SmallAlloc` will return a buffer that is smaller than expected. As a result, future accesses to the buffer like `p[i]` will be out of bounds. These code patterns can result in remote code execution vulnerabilities.
26+
In case `i+j` overflows, `SmallAlloc` returns a buffer that is smaller than expected. As a result, future accesses to the buffer like `p[i]` are out of bounds. These code patterns can result in remote code execution vulnerabilities.
2727
2828
Our analysis engine's numerical solver have some limitations reasoning about numerical overflows. As a result, this check is using some heuristics and can sometimes be a bit noisy.
2929
30-
# Example
30+
## Example
3131
3232
To fix the code example above, make sure `i+j` cannot overflow. For example:
3333

docs/code-quality/c26832.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ void foo(unsigned short i, unsigned short j)
2525
}
2626
```
2727
28-
In `i + j`, `i` and `j` will be promoted to integers and the result of the addition will be stored into a temporary integer. This integer will be implicitly casted to `unsigned short` before the value is stored to `size`. The result of this cast might overflow. Consequently, `SmallAlloc` might end up returning a buffer smaller than expected. Future accesses like `p[i]` will be out of bounds. These code patterns can result in remote code execution vulnerabilities.
28+
In `i + j`, `i` and `j` will be promoted to integers and the result of the addition will be stored into a temporary integer. This integer is implicitly casted to `unsigned short` before the value is stored to `size`. The result of this cast might overflow. So, `SmallAlloc` might end up returning a buffer smaller than expected. Future accesses like `p[i]` are out of bounds. These code patterns can result in remote code execution vulnerabilities.
2929
3030
Our analysis engine's numerical solver have some limitations reasoning about numerical overflows. As a result, this check is using some heuristics and can sometimes be a bit noisy.
3131
32-
# Example
32+
## Example
3333
3434
To fix the code example above, make sure `i+j` cannot overflow. For example:
3535

docs/code-quality/c26833.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ void foo(unsigned i, unsigned j)
2828
}
2929
```
3030
31-
The code example above has a check `size > 50`. Unfortunately, this check is too late. `i + j` might overflow and produce a small value that passes the check. Consequently, `SmallAlloc` might allocate a buffer smaller than expected. Future accesses of the buffer like `p[i]` might be out of bounds. These code patterns can result in remote code execution vulnerabilities.
31+
The code example above has a check `size > 50`. Unfortunately, this check is too late. In case `i + j` overflows, it produces a small value that passes the check. So, `SmallAlloc` allocates a buffer smaller than expected. Future accesses of the buffer like `p[i]` are out of bounds. These code patterns can result in remote code execution vulnerabilities.
3232
3333
Our analysis engine's numerical solver have some limitations reasoning about numerical overflows. As a result, this check is using some heuristics and can sometimes be a bit noisy.
3434
35-
# Example
35+
## Example
3636
3737
To fix the code example above, make sure `i+j` cannot overflow. For example:
3838

docs/code-quality/c26835.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ helpviewer_keywords: ["C26835"]
1111
1212
## Remarks
1313

14-
When `RtlCompareMemory`'s return value is used in a boolean context (compared to 0 or converted to bool), it will evaluate to true whenever a single byte matches. This is often not intentional. To check for equality, consider using `RtlEqualMemory` instead.
14+
When `RtlCompareMemory`'s return value is used in a boolean context (compared to 0 or converted to bool), it evaluates to true whenever a single byte matches. This is often not intentional. To check for equality, consider using `RtlEqualMemory` instead.
1515

1616
## Examples
1717

0 commit comments

Comments
 (0)