Skip to content

Conversation

boblemaire
Copy link
Contributor

@boblemaire boblemaire commented Dec 22, 2017

cbuf.size() must be at least one byte larger than cbuf.available() for
logic to work. reject request to resize = available. Issue #4002.

cbuf.size() must be at least one byte larger than cbuf.available() for
logic to work.  reject request to resize = available.
@devyte devyte merged commit e4043e9 into esp8266:master Dec 26, 2017
@devyte
Copy link
Collaborator

devyte commented Dec 26, 2017

Thanks for finding this. It took me a while to understand the underlying issue. For the record, you are also correct in that cbuf allocates 1byte more than it really uses. Therefore, you can't allow downsizing to the exact number of elements contained, and must allow to the number of elements + 1 and above.
It may be worth considering replacing this code with a wrapper around an STL-style container, or e.g.: boost's ring buffer, but for now, your fix is enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants