Slide 55
Slide 55 text
55
def json_raw(stm):
while True:
stm.skipspaces()
c = stm.peek()
if c == 't':
return json_fixed(stm, 'true')
elif c == 'f':
return json_fixed(stm, 'false')
elif c == 'n':
return json_fixed(stm, 'null')
elif c == '"':
return json_string(stm)
elif c == '{':
return json_dict(stm)
elif c == '[':
return json_list(stm)
elif c in NUMSTART:
return json_number(stm)
raise JSONError(E_MALF, stm, stm.pos)
55
{
'' : [['']],
'' : [[''],
[''],
[''],
[''],
['true'], ['false'], ['null']],
'' : [['{', '','}'],
['{}']],
'' : [[',',','],
['']],
'' : [['',':', '']],
'' : [['[', '', ']'],
['[]']],
'' : [[',',','],
['']],
'' : [['"', '', '"'],
['""']],
'' : [['',''],
['']],
'' : [['']],
'' : [['',''],
['']],
'' : [[c] for c in string.characters]
'' : [[c] for c in string.digits]
}
Solution: Structure Aware Fuzzing
JSON Grammar