Repository navigation
Commit cd1f389
pgtype: bound array binary decode element length against remaining bytes
ArrayCodec.decodeBinary looped elementCount times reading
binary.BigEndian.Uint32(src[rp:]) then slicing src[rp:rp+elemLen]
without checking that rp+4 <= len(src) nor rp+elemLen <= len(src). A
server returning an array header claiming more elements than the body
holds, or a per-element length past the end, panicked the client.
Check remaining bytes before each Uint32 read and before each slice.
Reported by CrowdStrike (F06).1 parent ff27b5b commit cd1f389
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
286 | 289 | | |
287 | 290 | | |
288 | 291 | | |
289 | 292 | | |
290 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
291 | 297 | | |
292 | 298 | | |
293 | 299 | | |
| |||
0 commit comments