diff options
author | Luke Shumaker <lukeshu@datawire.io> | 2022-08-16 02:22:23 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@datawire.io> | 2022-08-16 02:29:04 -0600 |
commit | 9f75bb80b99f94c5c87582acb99e57c232caf01d (patch) | |
tree | 5da3c0cd1e62a09c3d77cb38dec1a67b931fa1fa /parse.go | |
parent | 8c0513a04ff3870f57bde230507aaa8c6b7e6e86 (diff) |
Run the fuzzer a bit
Diffstat (limited to 'parse.go')
-rw-r--r-- | parse.go | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -238,6 +238,7 @@ type Parser struct { // // [ array: waiting for item to start or ']' // a array: reading item / waiting for ',' or ']' + // ] array: waiting for item to start // // Within each element type, the stack item is replaced, not pushed. // @@ -454,12 +455,21 @@ func (par *Parser) HandleRune(c rune) (RuneType, error) { par.pushState(RuneTypeError) return par.HandleRune(c) } + case RuneTypeArrayEnd: // waiting for item + switch c { + case 0x0020, 0x000A, 0x000D, 0x0009: + return RuneTypeSpace, nil + default: + par.replaceState(RuneTypeArrayComma) + par.pushState(RuneTypeError) + return par.HandleRune(c) + } case RuneTypeArrayComma: // waiting for ',' or ']' switch c { case 0x0020, 0x000A, 0x000D, 0x0009: return RuneTypeSpace, nil case ',': - par.replaceState(RuneTypeArrayBeg) + par.replaceState(RuneTypeArrayEnd) return RuneTypeArrayComma, nil case ']': par.popState() |