Fix out-of-bounds read in json_lex_string
authorJohn Naylor <john.naylor@postgresql.org>
Tue, 12 Jul 2022 04:13:41 +0000 (11:13 +0700)
committerJohn Naylor <john.naylor@postgresql.org>
Tue, 12 Jul 2022 04:25:47 +0000 (11:25 +0700)
commitd3117fc1a3e87717a57be0153408e5387e265e1b
treed5054f87f409950725fd304332186a68825a53ef
parent3b00a944a9b3847fb02dae7c9ea62fe0b211b396
Fix out-of-bounds read in json_lex_string

Commit 3838fa269 added a lookahead loop to allow building strings multiple
bytes at a time. This loop could exit because it reached the end of input,
yet did not check for that before checking if we reached the end of a
valid string. To fix, put the end of string check back in the outer loop.

Per Valgrind animal skink
src/common/jsonapi.c