Skip to content

Commit

Permalink
writableTail should not be const
Browse files Browse the repository at this point in the history
Summary: A `const IOBufQueue` should not leak mutable references to its innards. This can be a footgun. For example, `const` conventionally means "thread-safe". Writing through `writableTail` on a `const IOBuf*` that's shared across threads is anything but safe.

Reviewed By: ot

Differential Revision: D58380170

fbshipit-source-id: 4909624e650b3a8c2185167a68fd39b8b1eaa1a9
  • Loading branch information
snarkmaster authored and facebook-github-bot committed Jun 11, 2024
1 parent 5329008 commit e1c201f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion folly/io/IOBufQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ class IOBufQueue {
* @brief Get a pointer to the writable tail section.
* @methodset Access
*/
void* writableTail() const {
void* writableTail() {
dcheckCacheIntegrity();
return cachePtr_->cachedRange.first;
}
Expand Down

0 comments on commit e1c201f

Please sign in to comment.