Commit 40b12c6
Fix integer overflow in array_agg(), when the array grows too large
If you accumulate many arrays full of NULLs, you could overflow
'nitems', before reaching the MaxAllocSize limit on the allocations.
Add an explicit check that the number of items doesn't grow too large.
With more than MaxArraySize items, getting the final result with
makeArrayResultArr() would fail anyway, so better to error out early.
Reported-by: Xint Code
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 14
Security: CVE-2026-6473
(cherry picked from commit e24fb3247644a9baef72758806d83ec59d914781)1 parent 0cf2b56 commit 40b12c6
1 file changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5585 | 5585 | | |
5586 | 5586 | | |
5587 | 5587 | | |
| 5588 | + | |
5588 | 5589 | | |
5589 | 5590 | | |
5590 | 5591 | | |
| |||
5614 | 5615 | | |
5615 | 5616 | | |
5616 | 5617 | | |
| 5618 | + | |
| 5619 | + | |
| 5620 | + | |
| 5621 | + | |
| 5622 | + | |
| 5623 | + | |
| 5624 | + | |
| 5625 | + | |
5617 | 5626 | | |
5618 | 5627 | | |
5619 | 5628 | | |
| |||
5679 | 5688 | | |
5680 | 5689 | | |
5681 | 5690 | | |
5682 | | - | |
5683 | | - | |
5684 | 5691 | | |
5685 | 5692 | | |
5686 | 5693 | | |
| |||
5704 | 5711 | | |
5705 | 5712 | | |
5706 | 5713 | | |
5707 | | - | |
| 5714 | + | |
5708 | 5715 | | |
5709 | 5716 | | |
5710 | 5717 | | |
| |||
0 commit comments