0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd::json::stack::member: Fix critical assertion; use stack buffer.

This commit is contained in:
Jason Volk 2020-04-15 16:06:47 -07:00
parent 777ea844e7
commit f288d4a816

View file

@ -1596,17 +1596,18 @@ ircd::json::stack::member::member(object &po,
if(po.mc)
s->append(',');
thread_local char tmp[2048];
static const printer::rule<string_view> rule
{
printer.name << printer.name_sep
};
char tmp[512];
mutable_buffer buf{tmp};
if(!printer(buf, rule, name))
if(unlikely(!printer(buf, rule, name)))
throw error
{
"member name overflow: max size is under %zu", sizeof(tmp)
"member name overflow: max size is under %zu",
sizeof(tmp)
};
assert(data(buf) >= tmp);