Repository navigation
Commit b28e65b
pgtype: bound array element count against remaining message bytes
cardinality() returns 0 on negative overflow, but on a 64-bit platform
int32 dimension lengths can produce a positive product that wraps int64
unpredictably; e.g. dims {2147483647, 2} → 4294967294, positive and
fitting in int64, passed straight to make([]T, ...) inside
SetDimensions. The header for this is 28 bytes.
Bound elementCount by len(src[rp:]) / 4 (each element carries at
minimum a 4-byte length header) before SetDimensions. This catches
both the overflow case and grossly over-claimed dimensions, and ties
the cap to the actual message body size rather than a fixed ceiling.
Reported by CrowdStrike (F07).1 parent cd1f389 commit b28e65b
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
270 | 278 | | |
271 | 279 | | |
272 | 280 | | |
273 | 281 | | |
274 | 282 | | |
275 | | - | |
276 | 283 | | |
277 | 284 | | |
278 | 285 | | |
| |||
0 commit comments