postgres.git / summary / log / commit / refs
commit 3fbec9e504b1b4dca0a30d4081e1eaa687510fc5
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Mon May 11 18:18:06 2026 +0000
First released in: 19.0, 14.23, 15.18, 16.14, 17.10, 18.4
Use palloc_array() in a few more places to avoid overflow
These could overflow on 32-bit systems.
Backpatch-through: 14
Security: CVE-2026-6473
contrib/hstore_plperl/hstore_plperl.c | 2 +-
contrib/hstore_plpython/hstore_plpython.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/hstore_plperl/hstore_plperl.c b/contrib/hstore_plperl/hstore_plperl.c
index 31393b4fa50..2727a5f2ceb 100644
--- a/contrib/hstore_plperl/hstore_plperl.c
+++ b/contrib/hstore_plperl/hstore_plperl.c
@@ -121,7 +121,7 @@ plperl_to_hstore(PG_FUNCTION_ARGS)
pcount = hv_iterinit(hv);
- pairs = palloc(pcount * sizeof(Pairs));
+ pairs = palloc_array(Pairs, pcount);
i = 0;
while ((he = hv_iternext(hv)))
diff --git a/contrib/hstore_plpython/hstore_plpython.c b/contrib/hstore_plpython/hstore_plpython.c
index e2bfc6da38e..b0af13945bb 100644
--- a/contrib/hstore_plpython/hstore_plpython.c
+++ b/contrib/hstore_plpython/hstore_plpython.c
@@ -150,7 +150,7 @@ plpython_to_hstore(PG_FUNCTION_ARGS)
Py_ssize_t i;
Pairs *pairs;
- pairs = palloc(pcount * sizeof(*pairs));
+ pairs = palloc_array(Pairs, pcount);
for (i = 0; i < pcount; i++)
{
[parent: 05e73b5c3578]