mirror of
https://github.com/matrix-construct/construct
synced 2024-06-02 18:18:56 +02:00
ircd::json: Require full range of control chars to be escaped.
This commit is contained in:
parent
75927abb42
commit
7984f4bdee
20
ircd/json.cc
20
ircd/json.cc
|
@ -98,21 +98,33 @@ struct ircd::json::input
|
|||
,"escaped unicode"
|
||||
};
|
||||
|
||||
const rule<> control
|
||||
{
|
||||
char_('\x00', '\x1F')
|
||||
,"control character"
|
||||
};
|
||||
|
||||
// characters that must be escaped
|
||||
const rule<> escaped
|
||||
{
|
||||
lit('"') | lit('\\') | lit('\b') | lit('\f') | lit('\n') | lit('\r') | lit('\t') | lit('\0')
|
||||
,"escaped"
|
||||
quote | escape | control
|
||||
,"escaped character"
|
||||
};
|
||||
|
||||
// characters that should appear after an escaping solidus
|
||||
const rule<> escaper
|
||||
{
|
||||
lit('"') | lit('\\') | lit('b') | lit('f') | lit('n') | lit('r') | lit('t') | lit('0') | unicode
|
||||
,"escaped"
|
||||
quote | escape | unicode
|
||||
| lit('b') | lit('f') | lit('n')
|
||||
| lit('r') | lit('t') | lit('0')
|
||||
,"escaper"
|
||||
};
|
||||
|
||||
// cscapers supersetting the rule above with addl non-canonical chars
|
||||
const rule<> escaper_nc
|
||||
{
|
||||
escaper | lit('/')
|
||||
,"escaper"
|
||||
};
|
||||
|
||||
const rule<string_view> chars
|
||||
|
|
Loading…
Reference in a new issue