Skip to content

fix: reject unterminated quoted JSONPath fields - #106

Open
MichaelScofield wants to merge 1 commit into
databendlabs:mainfrom
GreptimeTeam:fix/unterminated-jsonpath
Open

MichaelScofield wants to merge 1 commit into
databendlabs:mainfrom
GreptimeTeam:fix/unterminated-jsonpath

Conversation

@MichaelScofield

Copy link
Copy Markdown

Unterminated double-quoted JSONPath fields such as $."a currently panic when string() slices past the end of its input. Require a closing quote before constructing the remainder slice so these inputs return InvalidJsonPath.

Adds regression cases for bare/bracketed fields, escaped quotes and backslashes, Unicode content, and filter expressions. The new regression cases fail with the original parser and pass with the fix.

Fixes #105.

Validation:

  • cargo test (199 tests including doctests)
  • cargo test --no-default-features --features databend (194 tests including doctests)
  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • Original standalone reproducer now returns InvalidJsonPath for all three malformed inputs; the valid quoted-field control still parses.

Signed-off-by: luofucong <luofc@foxmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: parse_json_path panics on unterminated double-quoted fields

1 participant