diff --git a/test/src/unit-cbor.cpp b/test/src/unit-cbor.cpp index b0efe6bc..ba07026a 100644 --- a/test/src/unit-cbor.cpp +++ b/test/src/unit-cbor.cpp @@ -1295,7 +1295,8 @@ TEST_CASE("CBOR") CHECK_THROWS_AS(json::from_cbor(std::vector({0x82, 0x01})), json::parse_error&); CHECK_THROWS_AS(json::from_cbor(std::vector({0x9F, 0x01})), json::parse_error&); CHECK_THROWS_AS(json::from_cbor(std::vector({0xBF, 0x61, 0x61, 0xF5})), json::parse_error&); - + CHECK_THROWS_AS(json::from_cbor(std::vector({0xA1, 0x61, 0X61})), json::parse_error&); + CHECK_THROWS_AS(json::from_cbor(std::vector({0xBF, 0x61, 0X61})), json::parse_error&); CHECK_THROWS_WITH(json::from_cbor(std::vector({0x18})), "[json.exception.parse_error.110] parse error at 2: unexpected end of input"); @@ -1341,6 +1342,10 @@ TEST_CASE("CBOR") "[json.exception.parse_error.110] parse error at 3: unexpected end of input"); CHECK_THROWS_WITH(json::from_cbor(std::vector({0xBF, 0x61, 0x61, 0xF5})), "[json.exception.parse_error.110] parse error at 5: unexpected end of input"); + CHECK_THROWS_WITH(json::from_cbor(std::vector({0xA1, 0x61, 0x61})), + "[json.exception.parse_error.110] parse error at 4: unexpected end of input"); + CHECK_THROWS_WITH(json::from_cbor(std::vector({0xBF, 0x61, 0x61})), + "[json.exception.parse_error.110] parse error at 4: unexpected end of input"); CHECK(json::from_cbor(std::vector({0x18}), true, false).is_discarded()); CHECK(json::from_cbor(std::vector({0x19}), true, false).is_discarded()); @@ -1364,6 +1369,8 @@ TEST_CASE("CBOR") CHECK(json::from_cbor(std::vector({0x82, 0x01}), true, false).is_discarded()); CHECK(json::from_cbor(std::vector({0x9F, 0x01}), true, false).is_discarded()); CHECK(json::from_cbor(std::vector({0xBF, 0x61, 0x61, 0xF5}), true, false).is_discarded()); + CHECK(json::from_cbor(std::vector({0xA1, 0x61, 0x61}), true, false).is_discarded()); + CHECK(json::from_cbor(std::vector({0xBF, 0x61, 0x61}), true, false).is_discarded()); } SECTION("unsupported bytes") diff --git a/test/src/unit-msgpack.cpp b/test/src/unit-msgpack.cpp index 9cb3d18b..e1c209d9 100644 --- a/test/src/unit-msgpack.cpp +++ b/test/src/unit-msgpack.cpp @@ -1077,6 +1077,7 @@ TEST_CASE("MessagePack") CHECK_THROWS_AS(json::from_msgpack(std::vector({0xcf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})), json::parse_error&); CHECK_THROWS_AS(json::from_msgpack(std::vector({0xa5, 0x68, 0x65})), json::parse_error&); CHECK_THROWS_AS(json::from_msgpack(std::vector({0x92, 0x01})), json::parse_error&); + CHECK_THROWS_AS(json::from_msgpack(std::vector({0x81, 0xa1, 0x61})), json::parse_error&); CHECK_THROWS_WITH(json::from_msgpack(std::vector({0x87})), "[json.exception.parse_error.110] parse error at 2: unexpected end of input"); @@ -1114,6 +1115,8 @@ TEST_CASE("MessagePack") "[json.exception.parse_error.110] parse error at 4: unexpected end of input"); CHECK_THROWS_WITH(json::from_msgpack(std::vector({0x92, 0x01})), "[json.exception.parse_error.110] parse error at 3: unexpected end of input"); + CHECK_THROWS_WITH(json::from_msgpack(std::vector({0x81, 0xa1, 0x61})), + "[json.exception.parse_error.110] parse error at 4: unexpected end of input"); CHECK(json::from_msgpack(std::vector({0x87}), true, false).is_discarded()); CHECK(json::from_msgpack(std::vector({0xcc}), true, false).is_discarded()); @@ -1133,6 +1136,7 @@ TEST_CASE("MessagePack") CHECK(json::from_msgpack(std::vector({0xcf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}), true, false).is_discarded()); CHECK(json::from_msgpack(std::vector({0xa5, 0x68, 0x65}), true, false).is_discarded()); CHECK(json::from_msgpack(std::vector({0x92, 0x01}), true, false).is_discarded()); + CHECK(json::from_msgpack(std::vector({0x81, 0xA1, 0x61}), true, false).is_discarded()); } SECTION("unsupported bytes")