Repository navigation
Conversation
JeanMeche
force-pushed
the
fix/constant-pool-key-escaping
branch
from
November 10, 2026 21:06
b94b407 to
e62232d
Compare
…onstantPool keys
Previously, GenericKeyFn.keyOf() wrapped string literals and quoted object literal keys in double quotes without length-prefixing or escaping. As a result, distinct array or object literals extracted during the template compiler's pure function optimization phase (such as ['a', 'b'] and ['a","b'], or {'a': 1, 'b': 2} and {'a":1,"b': 2}) produced identical constant pool keys and erroneously shared the same constant factory.
Prefix string literals and quoted object literal keys with their length ("<length>:<value>") in GenericKeyFn.keyOf() so embedded quotes and delimiters cannot cause key collisions without needing to scan or escape the string.
Fixes angular#71914
JeanMeche
force-pushed
the
fix/constant-pool-key-escaping
branch
from
November 10, 2026 21:37
e62232d to
f006b9a
Compare
JeanMeche
marked this pull request as ready for review
November 10, 2026 21:38
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.
Previously,
GenericKeyFn.keyOf()wrapped string literals and quoted object literal keys in double quotes without length-prefixing or escaping. As a result, distinct array or object literals extracted during the template compiler's pure function optimization phase (generatePureLiteralStructures/extractPureFunctions->PureFunctionConstantinConstantPool) such as["a", "b"]vs['a","b']or{"a": 1, "b": 2}vs{'a":1,"b': 2}produced identical constant pool keys (["a","b"]and{"a":1,"b":2}) and erroneously shared the same constant factory.This change prefixes string literals and quoted object literal keys with their length (
"${value.length}:${value}") inGenericKeyFn.keyOf(). This guarantees a prefix-free (uniquely decodable) key encoding with O(1) overhead and avoids scanning or escaping characters viaJSON.stringify().Fixes #71914