Fixed an access violation in DynamicJsonBuffer when memory allocation fails (issue #433)

This commit is contained in:
Benoit Blanchon
2017-01-31 10:06:40 +01:00
parent 3fd87e8e82
commit db9a76f7c6
4 changed files with 18 additions and 4 deletions

View File

@ -43,3 +43,9 @@ TEST_F(DynamicJsonBuffer_NoMemory_Tests, ParseObject) {
char json[] = "{}";
ASSERT_FALSE(_jsonBuffer.parseObject(json).success());
}
TEST_F(DynamicJsonBuffer_NoMemory_Tests, String) {
DynamicJsonBufferBase<NoMemoryAllocator>::String str = _jsonBuffer.startString();
str.append('!');
ASSERT_EQ(NULL, str.c_str());
}