Skip to content

Commit

Permalink
Return NotSupported for \u
Browse files Browse the repository at this point in the history
  • Loading branch information
bblanchon committed May 15, 2018
1 parent eec91aa commit de8545b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ArduinoJson/Json/Deserialization/JsonDeserializer.hpp
Expand Up @@ -185,7 +185,8 @@ class JsonDeserializer {

if (c == '\\') {
c = current();
if (c == 0) return DeserializationError::IncompleteInput;
if (c == '\0') return DeserializationError::IncompleteInput;
if (c == 'u') return DeserializationError::NotSupported;
// replace char
c = Encoding::unescapeChar(c);
if (c == '\0') return DeserializationError::InvalidInput;
Expand Down
6 changes: 6 additions & 0 deletions test/JsonDeserializer/deserializeJsonValue.cpp
Expand Up @@ -65,6 +65,12 @@ TEST_CASE("deserializeJson(DynamicJsonDocument&)") {
REQUIRE(doc.as<std::string>() == "1\"2\\3/4\b5\f6\n7\r8\t9");
}

SECTION("UTF-16 surrogate") {
DeserializationError err = deserializeJson(doc, "\"\\uD834\\uDD1E\"");

REQUIRE(err == DeserializationError::NotSupported);
}

SECTION("True") {
DeserializationError err = deserializeJson(doc, "true");

Expand Down

0 comments on commit de8545b

Please sign in to comment.