fix: reject invalid SemVer identifiers when parsing
Per SemVer 2.0.0 the core version numbers and numeric prerelease identifiers must not include leading zeroes, and prerelease/build-metadata identifiers must be composed only of ASCII alphanumerics and hyphens. Add IsValidIdentifiers using a vectorized SearchValues lookup for the allowed character set and ulong.TryParse to detect numeric identifiers for the leading-zero check. Add failing-then-passing tests for both invalid and still-valid inputs.
This commit is contained in:
parent
98f4a2165e
commit
b4ca01580a
3 changed files with 99 additions and 0 deletions
|
|
@ -16,6 +16,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
- Reject invalid SemVer identifiers when parsing versions.
|
||||
|
||||
### Removed
|
||||
|
||||
[1.0.0]: https://code.geekeey.de/geekeey/semver/releases/tag/1.0.0
|
||||
|
|
|
|||
Loading…
Reference in a new issue