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:
Louis Seubert 2026-07-11 21:56:56 +02:00
commit b4ca01580a
3 changed files with 99 additions and 0 deletions

View file

@ -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