-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additional PacketBuffer size fixes. (#8259)
* Additional PacketBuffer size fixes. #### Problem 1. After #8226, `PacketBuffer::kMaxSizeWithoutReserve` was wrong on LwIP builds. 2. It is possible for a `PacketBufferHandle::New()` to return a larger buffer than requested (e.g. when using a shared pool allocator), and in particular for it to return a block that is larger than *can* be requested. Attempting `CloneData()` on such a buffer fails with an error message logged by `PacketBufferHandle::New()`. #### Change overview 1. Fix `PacketBuffer::kMaxSizeWithoutReserve`. 2. As long as the excess space is not actually occupied (which would be incorrect, since it exceeds the spec size limit), `CloneData()` copies correctly to a maximum-size buffer. #### Testing Added a unit test to verify that a buffer with excess unused space is clonable, and a buffer with oversize space in use is not. * dynamically allocate test buffer * cast narrowing conversion
- Loading branch information
1 parent
4a2d7e7
commit 2342009
Showing
3 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters