Skip to content

xpath1.0 BUGFIX truncated token length and index when printing - #2652

Closed
affan-arch wants to merge 2 commits into
CESNET:develfrom
affan-arch:xpath10-token-narrowing
Closed

affan-arch wants to merge 2 commits into
CESNET:develfrom
affan-arch:xpath10-token-narrowing

Conversation

@affan-arch

Copy link
Copy Markdown

xpath1.0 token lengths and the token index are passed through uint16_t while struct lyxp_expr keeps tok_len and used as uint32_t, so a literal longer than 65535 characters is printed with its length truncated modulo 65536 (at exactly 65536 the token comes back NULL and the callers format it with "%s", so the value ends up holding the text "(null)"), and an expression with more than 65535 tokens makes the printing loop wrap the index back to 0 and never finish, all of it reachable from plain XML or JSON data because for those formats the canonical value is generated by this printer while storing.

@michalvasko
michalvasko changed the base branch from master to devel November 25, 2026 07:54
@michalvasko

Copy link
Copy Markdown
Member

Thanks but again, please always target devel branches with the PRs. There were conflicts that I resolved and merged manually.

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.

2 participants