pgsql: Protect against miscalculation of tuple sizes via int32 overflow
pgsql: Protect against miscalculation of tuple sizes via int32 overflow
От:
Noah Misch <noah@leadboat.com>
Дата:
Protect against miscalculation of tuple sizes via int32 overflow In-memory tuple sizes were being calculated in 64-bit-sized variables and later assigned to 32-bit variables, potentially leading to integer wraparound, which could then be used to overwrite server memory with attacker-controlled contents. Repair by using overflow-aware addition and, for additions done in loops, checking that the result complies with the 1GB palloc limit at each step. Reported-by: Hillai Ben Sasson Reported-by: Jayden Sarveshkumar Reported-by: Mehmet Ince Author: Álvaro Herrera Reviewed-by: Tatsuo Ishii Security: CVE-2026-120139 Backpatch-through: 14 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/aa2d0aefec71eec88dbab334b42a5f83360c1df7 Author: Álvaro Herrera Modified Files -------------- src/backend/access/common/heaptuple.c | 59 +++++++++++++++++++++++++++++---- src/backend/access/heap/heaptoast.c | 20 ++++++----- src/backend/executor/execTuples.c | 5 +++ src/backend/utils/adt/array_userfuncs.c | 3 +- src/backend/utils/adt/multirangetypes.c | 7 ++++ src/include/access/htup_details.h | 4 +++ src/include/access/tupmacs.h | 31 +++++++++++++++++ 7 files changed, 113 insertions(+), 16 deletions(-)