mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
Fix String.replace overlapping strcpy (#5966)
* Fix String.replace overlapping strcpy Fixes #5949 Adds a test from the issue above and fixes the problem valgrind found. Additional pathological memcpy->memmove fixes
This commit is contained in:
committed by
GitHub
parent
4b596d8fb1
commit
9712170276
@ -428,3 +428,15 @@ TEST_CASE("String SSO handles junk in memory", "[core][String]")
|
||||
REQUIRE(*s == "CO2_defect");
|
||||
s->~String();
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Issue #5949 - Overlapping src/dest in replace", "[core][String]")
|
||||
{
|
||||
String blah = "blah";
|
||||
blah.replace("xx", "y");
|
||||
REQUIRE(blah == "blah");
|
||||
blah.replace("x", "yy");
|
||||
REQUIRE(blah == "blah");
|
||||
blah.replace(blah, blah);
|
||||
REQUIRE(blah == "blah");
|
||||
}
|
||||
|
Reference in New Issue
Block a user