Skip to content

model: fix value-escaping round trip for runes above U+FFFFF - #995

Open
Rohilalala wants to merge 1 commit into
prometheus:mainfrom
Rohilalala:fix/unescape-value-supplementary-runes
Open

Rohilalala wants to merge 1 commit into
prometheus:mainfrom
Rohilalala:fix/unescape-value-supplementary-runes

Conversation

@Rohilalala

Copy link
Copy Markdown
Contributor

UnescapeName(..., ValueEncodingEscaping) checked its 6-hex-digit limit before it looked for the closing _. So every code point that needs exactly 6 hex digits (U+100000 to U+10FFFF) was rejected, and the escaped name came back unchanged.

Before: UnescapeName("U__a_10ffff_b", ValueEncodingEscaping) returns "U__a_10ffff_b".
After: it returns "a\U0010FFFFb".

7 or more digits, surrogates and values above U+10FFFF are still rejected. This affects callers that unescape U__ names, such as Prometheus's label values API and Pushgateway grouping keys when UTF-8 names are enabled.

Not changed: legacy-valid names that already start with U__ (e.g. U__foo) are not escaped by EscapeName, so they unescape to foo.

UnescapeName with ValueEncodingEscaping checked the 6-hex-digit limit
before looking for the closing underscore, so any rune in U+100000 to
U+10FFFF (e.g. "U__a_10ffff_b") was rejected and the escaped name was
returned unchanged. Check for the closing underscore first; 7+ digits,
surrogates and values above U+10FFFF are still rejected.

Signed-off-by: Aditya <205600203+Rohilalala@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant