Re: pg_parse_json() should not leak token copies on failure
Jacob Champion <jacob.champion@enterprisedb.com>
From: Jacob Champion <jacob.champion@enterprisedb.com>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: pgsql-hackers@postgresql.org, Michael Paquier <michael@paquier.xyz>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: 2024-10-07T22:45:25Z
Lists: pgsql-hackers
Attachments
- since-v3.diff.txt (text/plain)
- v4-0001-jsonapi-add-lexer-option-to-keep-token-ownership.patch (application/octet-stream) patch v4-0001
- v4-0002-jsonapi-fully-initialize-dummy-lexer.patch (application/octet-stream) patch v4-0002
On Wed, Oct 2, 2024 at 10:45 AM Andrew Dunstan <andrew@dunslane.net> wrote: > Generally looks good. Should we have a check in > setJsonLexContextOwnsTokens() that we haven't started parsing yet, for > the incremental case? Good catch. Added in v4. > > At the moment, we have a test matrix consisting of "standard frontend" > > and "shlib frontend" tests for the incremental parser. I'm planning > > for the v4 patch to extend that with a "owned/not owned" dimension; > > any objections? > > > > Sounds reasonable. This is also done, along with runs of pgindent/perltidy. I've added a 0002 as well. While running tests under Valgrind, it complained about the uninitialized dummy_lex on the stack, which is now fixed. (That bug was introduced with my patch in 0785d1b8b and is technically orthogonal to 0001, but I figured I could track it here for now.) This is also how I found out that my existing fuzzers weren't checking for uninitialized memory, like I thought they were. Grumble... Thanks, --Jacob
Commits
-
jsonapi: add lexer option to keep token ownership
- 5c32c21afe64 18.0 landed