0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-14 00:34:18 +01:00

ircd::spirit: Assertions for output buffer state in generate template.

This commit is contained in:
Jason Volk 2020-06-23 00:53:56 -07:00
parent 4823375701
commit 9dd9875611

View file

@ -319,7 +319,8 @@ ircd::spirit::generate(mutable_buffer &out,
if constexpr(truncation)
{
begin(out) = state.overflow? end(out) : begin(out);
assert(begin(out) <= end(out));
begin(out) = state.overflow? end(out): begin(out);
assert(!state.overflow || begin(out) == end(out));
assert(begin(out) <= end(out));
return ret;
@ -334,6 +335,7 @@ ircd::spirit::generate(mutable_buffer &out,
std::distance(start, begin(out))
};
assert(begin(out) <= end(out));
throw buffer_overrun
{
"Insufficient buffer of %s; required at least %s",