Fix unescape of escaped literals in TEXT values and parameter values - #13
Open
gaoflow wants to merge 2 commits into
Open
Fix unescape of escaped literals in TEXT values and parameter values#13gaoflow wants to merge 2 commits into
gaoflow wants to merge 2 commits into
Conversation
UnescapeText and ParameterExtensions.Unescape used sequential string.Replace calls whose tokens overlap the escaped-escape token, so an escaped literal decoded to the wrong character: - \\n (literal backslash + n) became a newline instead of \n - ^^n / ^^' (escaped caret + n / ') became ^ + newline / ^" instead of ^n / ^' Replace the sequential replaces with one forward scan that consumes each escape token once; undefined escapes keep both characters.
nuget.org republished Microsoft.NET.ILLink.Tasks 10.0.10, so the pinned contentHash in VSyntaxReader/packages.lock.json no longer matches the downloaded package and 'dotnet restore --locked-mode' fails with NU1403 on a fresh machine. Regenerated by dotnet restore.
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.
Both un-escapers decoded with sequential global Replace calls whose tokens overlap the escaped-escape token:
UnescapeText:\\n(an escaped literal backslash + n, RFC 5545) collapsed to\nand then decoded to a newline.ParameterExtensions.Unescape:^^n/^^'(escaped caret + n / apostrophe, RFC 6868) decoded to^+newline /^"instead of^n/^'.Replaced the sequential replaces with a single forward scan that consumes each escape token once; undefined escapes keep both characters, as before.
Tests cover the affected round-trips, each escape token's decode, and an exhaustive round-trip over the escape surface (all 370 tests pass).
Separate commit: refresh
VSyntaxReader/packages.lock.json— nuget.org republishedMicrosoft.NET.ILLink.Tasks 10.0.10, so the pinned hash is stale anddotnet restore --locked-modefails with NU1403 on a fresh machine.