Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in libember StreamBuffer::clear() #48

Closed
4ca opened this issue Jun 22, 2016 · 1 comment
Closed

Bug in libember StreamBuffer::clear() #48

4ca opened this issue Jun 22, 2016 · 1 comment
Labels
Milestone

Comments

@4ca
Copy link

4ca commented Jun 22, 2016

If the StreamBuffer is used to encode a large Glow tree into an S101 message with multiple packets of a given maximum size, two packets will be created, the first with the specified length, the second will be the length of all the remaining data. This is due to the StreamBuffer's clear function not clearing the internal buffer correctly.

Current version:-
template<typename ValueType, unsigned short ChunkSize>
inline void StreamBuffer<ValueType, ChunkSize>::clear()
{
StreamBuffer empty();
swap(empty);
}

Suggested solution:-
template<typename ValueType, unsigned short ChunkSize>
inline void StreamBuffer<ValueType, ChunkSize>::clear()
{
StreamBuffer empty(max_size());
swap(empty);
}

@KimonHoffmann
Copy link
Contributor

KimonHoffmann commented Jul 19, 2016

Hi!

Thanks for spotting this! Could you you provide us with a pull request with the proposed fix applied?

Thanks in advance and best regards,
Kimon

@KimonHoffmann KimonHoffmann added this to the Release v1.8 milestone Oct 4, 2016
KimonHoffmann added a commit that referenced this issue Oct 14, 2016
Maxsize is now preserved when calling StreamBuffer::clear().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants