Skip to content

Commit

Permalink
Fix out-of-bounds error that can be obtained when an atdgen parser
Browse files Browse the repository at this point in the history
parses an unquoted JSON field.
TODO: write a unit test.
  • Loading branch information
mjambon committed Jul 20, 2022
1 parent cc14b52 commit 79a0143
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/read.mll
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@

let map_lexeme f lexbuf =
let len = lexbuf.lex_curr_pos - lexbuf.lex_start_pos in
f (Bytes.sub_string lexbuf.lex_buffer lexbuf.lex_start_pos len) lexbuf.lex_start_pos len
f (Bytes.sub_string lexbuf.lex_buffer lexbuf.lex_start_pos len) 0 len

type variant_kind = [ `Edgy_bracket | `Square_bracket | `Double_quote ]
type tuple_kind = [ `Parenthesis | `Square_bracket ]
Expand Down

0 comments on commit 79a0143

Please sign in to comment.