Repository navigation
fix(material/slider): prevent out of memory errors from tick marks on… - #34037
Merged
Merged
Conversation
… the server The slider only renders its tick marks once it has a width, but it was computing them regardless, allocating one array entry per tick mark. Since the number of entries is derived from the `min`, `max`, `step` and value, a large range or a small step could result in an array big enough to exhaust the heap. This was especially problematic during server-side rendering, because the slider never has a width on the server so the array was always built and then discarded. If any of those inputs are derived from user input (e.g. query parameters), a single request could crash the server process along with every other request it was handling. These changes skip computing the tick marks until the slider has a width. Fixes angular#34036.
crisbeto
approved these changes
Nov 2, 2026
Member
crisbeto
pushed a commit
that referenced
this pull request
Nov 2, 2026
… the server (#34037) The slider only renders its tick marks once it has a width, but it was computing them regardless, allocating one array entry per tick mark. Since the number of entries is derived from the `min`, `max`, `step` and value, a large range or a small step could result in an array big enough to exhaust the heap. This was especially problematic during server-side rendering, because the slider never has a width on the server so the array was always built and then discarded. If any of those inputs are derived from user input (e.g. query parameters), a single request could crash the server process along with every other request it was handling. These changes skip computing the tick marks until the slider has a width. Fixes #34036. (cherry picked from commit 52264e4)
Contributor
Author
|
@crisbeto Out of curiosity, I think this could be considered a security issue if an unauthenticated or low privileged attacker can control this value through a CMS API, query params, or configuration in SSR. Is there any reason why it wouldn't be? |
Member
|
I think that's a bit of a stretch. |
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.
The slider only renders its tick marks once it has a width, but it was computing them regardless, allocating one array entry per tick mark. Since the number of entries is derived from the
min,max,stepand value, a large range or a small step could result in an array big enough to exhaust the heap. This was especially problematic during server-side rendering, because the slider never has a width on the server so the array was always built and then discarded. If any of those inputs are derived from user input (e.g. query parameters), a single request could crash the server process along with every other request it was handling.These changes skip computing the tick marks until the slider has a width.
Fixes #34036