Fix out-of-bounds read in json_lex_string

John Naylor <john.naylor@postgresql.org>

Commit: d3117fc1a3e87717a57be0153408e5387e265e1b
Author: John Naylor <john.naylor@postgresql.org>
Date: 2022-07-12T04:25:47Z
Releases: 16.0
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

Files

PathChange+/−
src/common/jsonapi.c modified +10 −8