🐛 fixing CBOR's indefinity length strings #961

Beside the fix discussed in #961, we also had to re-adjust a test case. It seems that it was failing before, and I "fixed" it to work with the broken implementation...
This commit is contained in:
Niels Lohmann 2018-02-06 20:43:03 +01:00
parent 556e30f759
commit 8b457ace25
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
5 changed files with 21 additions and 6 deletions

View file

@ -1408,4 +1408,19 @@ TEST_CASE("regression tests")
"path": "/a/b/c"}])"_json),
"[json.exception.out_of_range.403] key 'a' not found");
}
SECTION("issue #961 - incorrect parsing of indefinite length CBOR strings")
{
std::vector<uint8_t> v_cbor =
{
0x7F,
0x64,
'a', 'b', 'c', 'd',
0x63,
'1', '2', '3',
0xFF
};
json j = json::from_cbor(v_cbor);
CHECK(j == "abcd123");
}
}