Skip to content

Commit 21b65b6

Browse files
authored
Add security warning to ArrayPool.Return documentation (#12062)
1 parent d8e55f3 commit 21b65b6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

xml/System.Buffers/ArrayPool`1.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@ The array returned by this method may not be zero-initialized.
309309
## Remarks
310310
311311
Once a buffer has been returned to the pool, the caller gives up all ownership of the buffer and must not use it. The reference returned from a given call to the <xref:System.Buffers.ArrayPool%601.Rent%2A> method must only be returned using the <xref:System.Buffers.ArrayPool%601.Return%2A> method once. The default <xref:System.Buffers.ArrayPool%601> may hold onto the returned buffer in order to rent it again, or it may release the returned buffer if it's determined that the pool already has enough buffers stored.
312+
313+
> [!IMPORTANT]
314+
> Returning the same array reference twice or continuing to use the array reference after it has been returned is a high-severity security issue. These actions can lead to [double-free](https://cwe.mitre.org/data/definitions/415.html) and [use-after-free](https://cwe.mitre.org/data/definitions/416.html) vulnerabilities, which might result in data corruption, data leaks, and denial of service.
312315
]]></format>
313316
</remarks>
314317
</Docs>

0 commit comments

Comments
 (0)