|
|
|
|
|
by lifthrasiir
884 days ago
|
|
That got me nerd-sniped. The following grammar describes all possible JSON-JSONB polyglots: d = '0' | ... | '9'
e = 'E' | 'e'
int-frag = d d d
canon-float-frag = int-frag | d e d | d '.' d
float-frag = canon-float-frag | '.' d d | d d '.'
float-suffix-frag = float-frag | e '+' d | e '-' d | e d d | '.' e d
string-type = '7' | '8' | '9'
polyglot-json =
'3' int-frag |
'5' canon-float-frag |
'6' float-frag |
string-type float-suffix-frag |
'[' '\x09' string-type float-suffix-frag ']'
There are some additional possibilities like `40e3` which are rejected by the validation code but otherwise accepted. (`4` encodes a three-byte-long hexadecimal literal.) |
|