fix: avoid infinite recursion when formatting ranges as short npm
TryFormat for the "ns" format returned false for any set that can
not be expressed as a caret/tilde range. The public ToString
routes through DefaultInterpolatedStringHandler, whose buffer-full
fallback re-enters ToString, causing an infinite loop / stack overflow.
For "ns", fall back to the full comparator ("n") form when the
compact form cannot represent the set, so the call always succeeds
for a representable range. A genuine buffer overflow still returns
false as before.
Add failing-then-passing tests.
This commit is contained in:
parent
2ea7866e3b
commit
ae2163188f
3 changed files with 34 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
- Reject invalid SemVer identifiers when parsing versions.
|
||||
- Range exact and non-equal comparators ignore build metadata when matching versions.
|
||||
- Avoid infinite recursion when formatting ranges in the short npm (`ns`) form.
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue