Repository navigation
Commit a4f6d75
authored
quic: validate session close error codes
`session.close()` and `session.destroy()` only checked that
`options.code` was a bigint or a number. Numbers were then converted
to `uint64_t` unchecked, so fractions were truncated and negative,
non-finite or too large values were undefined behavior. Bigints were
only checked to fit in 64 bits, but QUIC error codes are
variable-length integers limited to 62 bits, so larger codes cannot
be encoded in the `CONNECTION_CLOSE` frame.
Reject codes that are not integers between `0` and `2n ** 62n - 1n`,
the range `QuicError` already enforces, before any close or destroy
side effects.
Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
PR-URL: #66302
Reviewed-By: Tim Perry <pimterry@gmail.com>1 parent 8314231 commit a4f6d75
3 files changed
Lines changed: 32 additions & 5 deletions
File tree
- doc/api
- lib/internal/quic
- test/parallel
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
974 | 974 | | |
975 | 975 | | |
976 | 976 | | |
977 | | - | |
| 977 | + | |
| 978 | + | |
978 | 979 | | |
979 | 980 | | |
980 | 981 | | |
| |||
1056 | 1057 | | |
1057 | 1058 | | |
1058 | 1059 | | |
1059 | | - | |
| 1060 | + | |
| 1061 | + | |
1060 | 1062 | | |
1061 | 1063 | | |
1062 | 1064 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
5485 | 5486 | | |
5486 | 5487 | | |
5487 | 5488 | | |
| 5489 | + | |
| 5490 | + | |
| 5491 | + | |
| 5492 | + | |
| 5493 | + | |
| 5494 | + | |
| 5495 | + | |
5488 | 5496 | | |
5489 | 5497 | | |
5490 | 5498 | | |
| |||
Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
100 | 114 | | |
101 | 115 | | |
102 | 116 | | |
| |||
107 | 121 | | |
108 | 122 | | |
109 | 123 | | |
110 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
111 | 127 | | |
112 | 128 | | |
113 | 129 | | |
| 130 | + | |
114 | 131 | | |
115 | 132 | | |
116 | 133 | | |
117 | | - | |
| 134 | + | |
118 | 135 | | |
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
122 | | - | |
| 139 | + | |
123 | 140 | | |
124 | 141 | | |
125 | 142 | | |
| |||
0 commit comments