Skip to content

fix: prevent panic in markdown-json-cite with non-ASCII input - #162

Open
Kubudak90 wants to merge 1 commit into
ethereum:masterfrom
Kubudak90:fix/issue-100-non-ascii-panic
Open

fix: prevent panic in markdown-json-cite with non-ASCII input#162
Kubudak90 wants to merge 1 commit into
ethereum:masterfrom
Kubudak90:fix/issue-100-non-ascii-panic

Conversation

@Kubudak90

Copy link
Copy Markdown

Fixes #100.

Bug: When a CSL-JSON citation block contains non-ASCII characters (e.g., "Mazières"), panics with:

Root cause: In , the annotation span was computed using , which returns the byte length of the UTF-8 string. However, expects character counts for its ranges. Non-ASCII characters like take 2 bytes in UTF-8, causing the span end to exceed the source length in characters.

Fix: Replace with so the span uses character count instead of byte length.

Testing:

  • Added an integration test case () that reproduces the exact input from the issue.
  • Added unit tests (, , ) to verify the fix prevents the panic and correctly reports the schema validation error.

…ations

Fixes panic on non-ASCII characters in csl-json blocks.

Closes ethereum#100
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.

1 participant