mirror of
https://github.com/nlohmann/json.git
synced 2026-07-21 19:23:03 +04:00
🐛 fix BSON conformance issue
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -472,8 +472,8 @@ class binary_reader
|
|||||||
auto last_token = get_token_string();
|
auto last_token = get_token_string();
|
||||||
return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read,
|
return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read,
|
||||||
exception_message(input_format_t::bson,
|
exception_message(input_format_t::bson,
|
||||||
"BSON document terminator did not land at declared document size",
|
"BSON array terminator did not land at declared array size",
|
||||||
"document"), nullptr));
|
"array"), nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sax->end_array();
|
return sax->end_array();
|
||||||
|
|||||||
@@ -10614,8 +10614,8 @@ class binary_reader
|
|||||||
auto last_token = get_token_string();
|
auto last_token = get_token_string();
|
||||||
return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read,
|
return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read,
|
||||||
exception_message(input_format_t::bson,
|
exception_message(input_format_t::bson,
|
||||||
"BSON document terminator did not land at declared document size",
|
"BSON array terminator did not land at declared array size",
|
||||||
"document"), nullptr));
|
"array"), nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sax->end_array();
|
return sax->end_array();
|
||||||
|
|||||||
@@ -1347,7 +1347,7 @@ TEST_CASE("Invalid document size handling")
|
|||||||
0x00 // object terminator
|
0x00 // object terminator
|
||||||
};
|
};
|
||||||
json _;
|
json _;
|
||||||
CHECK_THROWS_WITH_AS(_ = json::from_bson(v), "[json.exception.parse_error.112] parse error at byte 19: syntax error while parsing BSON document: BSON document terminator did not land at declared document size", json::parse_error&);
|
CHECK_THROWS_WITH_AS(_ = json::from_bson(v), "[json.exception.parse_error.112] parse error at byte 19: syntax error while parsing BSON array: BSON array terminator did not land at declared array size", json::parse_error&);
|
||||||
CHECK(json::from_bson(v, true, false).is_discarded());
|
CHECK(json::from_bson(v, true, false).is_discarded());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user