{{ message }}
Repository navigation
fix out-of-bounds read in json path ReadKey lookahead - #23371
Merged
Mytherin merged 1 commit intoJun 23, 2026
Merged
Conversation
duckdb-draftbot
marked this pull request as draft
June 19, 2026 06:53
Member
jmestwa-coder
force-pushed
the
json-path-readkey-bound
branch
from
June 22, 2026 13:39
a7395a2 to
a9c330c
Compare
Contributor
Author
|
rebased onto v1.5-variegata and retargeted the PR. the fix and both test cases carried over cleanly. |
Mytherin
marked this pull request as ready for review
June 22, 2026 15:33
Member
kaka11chen
pushed a commit
to kaka11chen/astrovela_vane
that referenced
this pull request
Aug 14, 2026
…23371) Two lookahead reads in the JSON path parser (ReadKey) run one byte past the path while only one byte is guaranteed left: - the `**` wildcard check reads `*(ptr + 1)`, hitting `*end` when `*` ends the path - the recursive `.` branch reads the same byte, then walks ptr past end Reachable from a non-constant path arg whose string_t is non-inlined (> 12 bytes, so not null-terminated), e.g. `json_extract(j, '$.aaaaaaaaaaaa.*')`. ASan flags a heap-buffer-overflow read of size 1 in ReadKey. Constant paths come from a null-terminated copy and are unaffected. Bounded both lookaheads against end and reject a trailing recursive `.`. Upstream-Commit: duckdb/duckdb@c9c0950
8 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Two lookahead reads in the JSON path parser (ReadKey) run one byte past the path while only one byte is guaranteed left:
**wildcard check reads*(ptr + 1), hitting*endwhen*ends the path.branch reads the same byte, then walks ptr past endReachable from a non-constant path arg whose string_t is non-inlined (> 12 bytes, so not null-terminated), e.g.
json_extract(j, '$.aaaaaaaaaaaa.*'). ASan flags a heap-buffer-overflow read of size 1 in ReadKey. Constant paths come from a null-terminated copy and are unaffected. Bounded both lookaheads against end and reject a trailing recursive..