Commit 26820a92 authored by Kamal Marhubi's avatar Kamal Marhubi

Fix off by one error in advance

parent b17faeec
......@@ -196,6 +196,15 @@ KJ_TEST("basic json decoding") {
KJ_EXPECT(root.getNull() == VOID);
}
{
MallocMessageBuilder message;
auto root = message.initRoot<JsonValue>();
json.decodeRaw(kj::str("null"), root);
KJ_EXPECT(root.which() == JsonValue::NULL_);
KJ_EXPECT(root.getNull() == VOID);
}
{
MallocMessageBuilder message;
auto root = message.initRoot<JsonValue>();
......
......@@ -488,7 +488,7 @@ public:
}
void advance(size_t numBytes = 1) {
KJ_REQUIRE(numBytes < remaining_.size(), "JSON message ends prematurely.");
KJ_REQUIRE(numBytes <= remaining_.size(), "JSON message ends prematurely.");
remaining_ = kj::arrayPtr(remaining_.begin() + numBytes, remaining_.end());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment