Skip to content

Commit

Permalink
fix: uint64 overflow creates bad GREASE (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaukas authored Jul 27, 2023
1 parent 79d22eb commit 7ddf9dc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion quic_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ func unsetVLIBits(vli []byte) {
}

func IsGREASETransportParameter(paramType uint64) bool {
return (paramType-27)%31 == 0 // reserved values are 27, 58, 89, ...
return paramType >= 27 && (paramType-27)%31 == 0 // reserved values are 27, 58, 89, ...
}
26 changes: 26 additions & 0 deletions quic_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,32 @@ func TestDecodeVLI(t *testing.T) {
}

var mapQUICGREASEValues = map[uint64]bool{
0x01: false,
0x02: false,
0x03: false,
0x04: false,
0x05: false,
0x06: false,
0x07: false,
0x08: false,
0x09: false,
0x0a: false,
0x0b: false,
0x0c: false,
0x0d: false,
0x0e: false,
0x0f: false,
0x10: false,
0x11: false,
0x12: false,
0x13: false,
0x14: false,
0x15: false,
0x16: false,
0x17: false,
0x18: false,
0x19: false,
0x1a: false,
27: true,
31: false,
58: true,
Expand Down

0 comments on commit 7ddf9dc

Please sign in to comment.