-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Stack smashing protection failure occurs in String #3140
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
Comments
It seems to be something unsafe in String::replace. If you convert them to char* with |
I bisected to commit ab309e4 |
@lbernstone unfortunately that's my big "convert to SSO" commit which doesn't really narrow it down. :( I do most of my work on the 8266 where there's no such protection, but we do run on valgrind on the host tests (imperfect match for the 8266 HW, but best we can do). We have had several fixes to the SSO implementation, involving string replacement: In particular, esp8266/Arduino@54240d2#diff-8d9e71e16d437343017df828f0528f63 A reproducible failing test case was found there and corrected, this could be the same thing. |
@atanisoft I tested with 1.0.2 and it works fine. |
@earlephilhower perhaps a resync should be done? |
Yes, @Hieromon , it looks like the same thing. @atanisoft I'll put in a PR later this morning. |
Pull in bugfixes from the ESP8266 repo for problems in the SSO implementation of replace(). See the following patches for full details: esp8266/Arduino@54240d2#diff-8d9e71e16d437343017df828f0528f63 esp8266/Arduino@78a1a66#diff-8d9e71e16d437343017df828f0528f63 esp8266/Arduino@4e93584#diff-8d9e71e16d437343017df828f0528f63 Fixes espressif#3140
@Hieromon, could you please check the PR linked above and let us know if that cleans up your error? That PR is definitely necessary for the -32, no matter what. If there's still a problem then I've got to repro on the host and make a new PR in both the 8266 and 32 repos. |
@earlephilhower Your PR works fine, it's a great job. Thank you for the quick response as always. |
Might want to reopen until it's merged, @Hieromon ? The merge will close it automatically when completed. |
@earlephilhower Ok, My test is roughly finished, but let's resume it just in case and close by merging. |
Pull in bugfixes from the ESP8266 repo for problems in the SSO implementation of replace(). See the following patches for full details: esp8266/Arduino@54240d2#diff-8d9e71e16d437343017df828f0528f63 esp8266/Arduino@78a1a66#diff-8d9e71e16d437343017df828f0528f63 esp8266/Arduino@4e93584#diff-8d9e71e16d437343017df828f0528f63 Fixes #3140
Hardware:
Board: ESP32 Dev Module, also Heltec WiFi kit 32
Core Installation version: 1.0.3-rc2
IDE name: Arduino IDE 1.8.8 also 1.8.9
Flash Frequency: 80MHz
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Windows 7, Windows 10
Description:
Stack smashing protection failure occurs in String. This problem seems to be related to the order of dynamic allocation for String data in the function and the length of the string.
Sketch:
Debug Messages:
Stack dump decoded:
Preliminary survey:
The violation seems to be caused by releasing the string buffer in the termination process of the setup().
Oddly if the position of the
reps
initialization statement moves, the problem does not occur.The above sketch successfully ended.
The text was updated successfully, but these errors were encountered: