Skip to content

Commit d007466

Browse files
committed
Fixed another fuzz-found bug
1 parent a355124 commit d007466

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,11 @@ To give you an idea on how it works, the following table shows some examples of
113113
| ------------------ | ------------------ |
114114
| `1.2.4` | `1.2.4;` |
115115
| `1.3.0-rc` | `1.3.0-;rc` |
116-
| `1.3.0-rc.0` | `1.3.0-;rc.:0` |
117-
| `1.3.0-rc.5` | `1.3.0-;rc.:5` |
118-
| `1.3.0-rc.5+build` | `1.3.0-;rc.:5` |
119-
| `1.3.0-rc.20` | `1.3.0-;rc.::20` |
116+
| `1.3.0-rc.0` | `1.3.0-;rc,:0` |
117+
| `1.3.0-rc.5` | `1.3.0-;rc,:5` |
118+
| `1.3.0-rc.5+build` | `1.3.0-;rc,:5` |
119+
| `1.3.0-rc.20` | `1.3.0-;rc,::20` |
120+
| `1.3.0-rc-` | `1.3.0-;rc-` |
120121
| `1.3.0` | `1.3.0;` |
121122
| `1.20.0` | `1.:20.0;` |
122123
| `1.90.0` | `1.:90.0;` |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
go test fuzz v1
2+
string("0.0.2-rc-")
3+
string("0.0.2-rc.0")

version.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,10 @@ func (v *Version) SortableString() string {
480480
for curr, c := range prerelease {
481481
if c == '.' {
482482
add(prerelease[start:curr])
483-
res += "."
483+
// separate the pre-release pieces with a "," to ensure the correct ordering
484+
// of the pre-release pieces (the separator must be lower than any other allowed
485+
// character [a-zA-Z0-9-]).
486+
res += ","
484487
start = curr + 1
485488
continue
486489
}

0 commit comments

Comments
 (0)