mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Fixed an access violation in DynamicJsonBuffer when memory allocation fails (issue #433)
				
					
				
			This commit is contained in:
		| @@ -1,6 +1,11 @@ | ||||
| ArduinoJson: change log | ||||
| ======================= | ||||
|  | ||||
| HEAD | ||||
| ---- | ||||
|  | ||||
| * Fixed an access violation in `DynamicJsonBuffer` when memory allocation fails (issue #433) | ||||
|  | ||||
| v5.8.2 | ||||
| ------ | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| Arduino JSON library | ||||
| ArduinoJson - C++ JSON library for IoT | ||||
| ==================== | ||||
|  | ||||
| [](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/master) [](https://travis-ci.org/bblanchon/ArduinoJson) [](https://coveralls.io/r/bblanchon/ArduinoJson?branch=master) [](https://github.com/bblanchon/ArduinoJson) | ||||
| @@ -36,7 +36,7 @@ Works on | ||||
| * RedBearLab boards (BLE Nano...) | ||||
| * Computers (Windows, Linux, OSX...) | ||||
|  | ||||
| See [FAQ: Compatibility issues](https://github.com/bblanchon/ArduinoJson/wiki/Compatibility-issues) | ||||
| See [FAQ: Compatibility issues](https://bblanchon.github.io/ArduinoJson/faq/compilation-fails-device-crashes-nothing-on-serial-console) | ||||
|  | ||||
| Quick start | ||||
| ----------- | ||||
| @@ -82,7 +82,10 @@ root.printTo(Serial); | ||||
| Documentation | ||||
| ------------- | ||||
|  | ||||
| The documentation is available online in the [Arduino JSON wiki](https://github.com/bblanchon/ArduinoJson/wiki) | ||||
| The documentation is available online in the [ArduinoJson wiki](https://github.com/bblanchon/ArduinoJson/wiki). | ||||
|  | ||||
| The [ArduinoJson Assistant](https://bblanchon.github.io/ArduinoJson/assistant/) helps you get started with the library. | ||||
|  | ||||
|  | ||||
| Testimonials | ||||
| ------------ | ||||
|   | ||||
| @@ -84,7 +84,7 @@ class DynamicJsonBufferBase | ||||
|         char* newStart = | ||||
|             static_cast<char*>(_parent->allocInNewBlock(_length + 1)); | ||||
|         if (_start && newStart) memcpy(newStart, _start, _length); | ||||
|         newStart[_length] = c; | ||||
|         if (newStart) newStart[_length] = c; | ||||
|         _start = newStart; | ||||
|       } | ||||
|       _length++; | ||||
|   | ||||
| @@ -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()); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user