Fix crash with tiny Flash strings (issue #2170)

This commit is contained in:
Benoit Blanchon
2025-04-11 10:23:43 +02:00
parent 96281de682
commit deab127a2f
6 changed files with 27 additions and 7 deletions
+7
View File
@@ -87,6 +87,13 @@ TEST_CASE("JsonDocument::set()") {
});
}
SECTION("Flash tiny string") { // issue #2170
doc.set(F("abc"));
REQUIRE(doc.as<const char*>() == "abc"_s);
REQUIRE(spy.log() == AllocatorLog{});
}
#ifdef HAS_VARIABLE_LENGTH_ARRAY
SECTION("VLA") {
size_t i = 16;