Repository navigation
Commit b4d6d4d
pgtype: bound range, multirange, and tsvector binary decoders
The same length-prefix-vs-remaining-bytes pattern that affects array
and hstore binary decoding also affected three more decoders:
- parseUntypedBinaryRange sliced lower/upper bound bytes without
checking the server-supplied valueLen against remaining bytes.
- MultirangeCodec.decodeBinary looped elementCount times reading and
slicing per-element bytes without bounds checks.
- tsvector binary decode read an int32 entryCount and called
make([]TSVectorLexeme, entryCount) without checking the negative or
oversized cases.
Add the same remaining-bytes checks as F05/F06: validate Uint32 reads
have at least 4 bytes available, validate per-value/per-element slice
lengths against remaining bytes, reject negative tsvector lexeme counts,
and bound entryCount against len(src[rp:]) / 3 (each lexeme needs at
minimum a 1-byte NUL terminator and a 2-byte position count).
Reported by CrowdStrike (F11).1 parent 0639b37 commit b4d6d4d
3 files changed
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
234 | 237 | | |
235 | 238 | | |
236 | 239 | | |
237 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
238 | 244 | | |
239 | 245 | | |
240 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
252 | 255 | | |
253 | 256 | | |
254 | 257 | | |
| |||
268 | 271 | | |
269 | 272 | | |
270 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
271 | 277 | | |
272 | 278 | | |
273 | 279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
206 | 216 | | |
207 | 217 | | |
208 | 218 | | |
| |||
0 commit comments