Files
swift-nio/Sources
Pranav R 53ac1ccab2 Document trapping behavior of ByteBuffer set*(at:) write APIs (#3659)
Motivation:

GHSA-ffw9-jrfx-pfvc raised a question about whether `setBytes(_:at:)`,
`setInteger(_:at:...)`, and `setString(_:at:)` correctly validate an
out-of-range `index`. On review, this turned out to be
working-as-intended: these APIs trap on an invalid index by design,
unlike the `get*` family, which validates via `rangeWithinReadableBytes`
and returns `nil` instead. That asymmetry wasn't previously called out
in the doc comments, which made it easy to mistake for an unmitigated
validation gap rather than documented behavior.

Modifications:

Added a `- Precondition:` note to the doc comments of `setBytes(_:at:)`
(all overloads), `setInteger(_:at:...)`, and `setString(_:at:)` in
NIOCore, making the trapping behavior explicit and noting that callers
must validate any externally-derived `index` before use.

Result:

No behavior changes. The trapping contract on these `set*` write APIs is
now documented, matching the existing convention used by `get*`'s
optional-return documentation.One line description of your change
2026-07-14 13:26:59 +00:00
..
2024-09-12 13:18:25 +01:00
2026-07-07 15:46:28 +01:00
2026-07-07 15:46:28 +01:00
2026-07-07 15:46:28 +01:00
2025-10-06 10:58:33 +01:00
2025-05-07 12:24:44 +00:00
2025-05-07 12:24:44 +00:00