-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
StreamString SSO bug #6035
StreamString SSO bug #6035
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. Thanks! Would you be able to add a test to the host tests that catches the error (you already have the code, just need to encapsulate it).
This also needs to apply to the ESP32 core. Do you want to submit a patch there or would you like me to?
As found by @mongozmaki in esp8266/Arduino#6035 With SSO implementation in String, StreamString::write generates wrong strings under some circumstances. Reason is that String::len() returns strlen(sso_buf) if SSO=true but with newly written data (in StreamString::write) the null-termination missing at the time len() is called. Furthermore, len() is called twice which is inefficient if SSO=true.
Hi! I will submit the same to the ESP32 |
As found by @mongozmaki in esp8266/Arduino#6035 With SSO implementation in String, StreamString::write generates wrong strings under some circumstances. Reason is that String::len() returns strlen(sso_buf) if SSO=true but with newly written data (in StreamString::write) the null-termination missing at the time len() is called. Furthermore, len() is called twice which is inefficient if SSO=true.
With SSO implementation in String,
StreamString::write
generates wrong strings under some circumstances.Reason is that
String::len()
returnsstrlen(sso_buf)
if SSO=true but with newly written data (inStreamString::write
) the null-termination missing at the timelen()
is called.Furthermore,
len()
is called twice which is inefficient if SSO=true.Testcode: