Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c163743
Harden tsvector code against overflows.
tglsfdc Aug 10, 2026
7d2170a
Harden tsquery code against overflows.
tglsfdc Aug 10, 2026
16364f5
Fix potential buffer overrun in regexp match/split functions.
MasahikoSawada Aug 10, 2026
a11a579
Harden PL/Perl code against "tied" Perl arrays and hashes.
tglsfdc Aug 10, 2026
8463075
Be more wary about constant's datatype in scalarineqsel().
tglsfdc Aug 10, 2026
1e1a6fe
Replace fixed-size, too-short array with a palloc'd one.
tglsfdc Aug 10, 2026
0d3b04c
pg_dump: avoid assuming how long pg_proc.protrftypes can be.
tglsfdc Aug 10, 2026
918078b
Protect some fixed-size arrays that have FUNC_MAX_ARGS elements.
tglsfdc Aug 10, 2026
732f2a8
Reject calls from SQL to functions that take or return type internal.
tglsfdc Aug 10, 2026
c7aa1e1
Return nulls honestly in aggregate "combine" functions.
tglsfdc Aug 10, 2026
3b340d7
Fix pg_trgm's picksplit function with all-true datums
hlinnaka Aug 10, 2026
1798a7f
Use palloc_array() in pltcl and plperl to avoid overflow
hlinnaka Aug 10, 2026
ae4c7c1
ecpg: Fix out-of-bound writes due to processing of invalid bytea data
michaelpq Aug 10, 2026
895314a
Obstruct EXTRACT() field name deparse injection.
nathan-bossart Aug 10, 2026
ed048bc
Use value of scram_iterations in mock_scram_secret().
nathan-bossart Aug 10, 2026
40f76ca
Empty search_path in amcheck.
nmisch Aug 10, 2026
ad3b13d
Cross-check the type of a portal running EXECUTE or FETCH.
robertmhaas Aug 10, 2026
6f39b92
Avoid overflow in Levenshtein distance calculations.
nathan-bossart Aug 10, 2026
8a11d65
Check for USAGE privilege on the subtype in CREATE TYPE AS RANGE.
nathan-bossart Aug 10, 2026
09cf4fe
Check for USAGE privilege on the composite type in ALTER TABLE OF.
nathan-bossart Aug 10, 2026
a368525
Invalidate plan cache after role changes.
nathan-bossart Aug 10, 2026
00e4d80
Save/restore more lexer state when skipping text due to \if.
tglsfdc Aug 10, 2026
223b2e6
Fix errorhandling for PGP encryption
danielgustafsson Aug 10, 2026
159eb9a
pgcrypto: Add option to revert to prior decryption behavior
jchampio Aug 10, 2026
8e3e5f4
psql: Don't do backquote expansion in \unrestrict.
nathan-bossart Aug 10, 2026
57a2a77
Backport adaptations
reshke Aug 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions contrib/amcheck/expected/check_btree.out
Original file line number Diff line number Diff line change
Expand Up @@ -186,27 +186,40 @@ SELECT bt_index_check('toasty', true);
(1 row)

--
-- Check that index expressions and predicates are run as the table's owner
-- Check that index expressions and predicates are run as the table's owner,
-- with empty search_path
--
TRUNCATE bttest_a;
INSERT INTO bttest_a SELECT * FROM generate_series(1, 1000);
ALTER TABLE bttest_a OWNER TO regress_bttest_role;
-- A dummy index function checking current_user
CREATE FUNCTION ifun(int8) RETURNS int8 AS $$
BEGIN
ASSERT current_user = 'regress_bttest_role',
ASSERT current_setting('search_path') NOT LIKE '%preempt%',
format('ifun(%s) called with current_schemas %s, search_path %s',
$1, current_schemas(true), current_setting('search_path'));
ASSERT "current_user"() = 'regress_bttest_role',
format('ifun(%s) called by %s', $1, current_user);
RETURN $1;
END;
$$ LANGUAGE plpgsql IMMUTABLE;
CREATE INDEX bttest_a_expr_idx ON bttest_a ((ifun(id) + ifun(0)))
WHERE ifun(id + 10) > ifun(10);
BEGIN;
SET LOCAL check_function_bodies = off;
CREATE SCHEMA preempt;
GRANT USAGE ON SCHEMA preempt TO regress_bttest_role;
SET LOCAL search_path = preempt, pg_catalog, public;
CREATE FUNCTION "current_user"() RETURNS name AS $$
broken
$$ LANGUAGE sql STABLE PARALLEL SAFE STRICT;
SELECT bt_index_check('bttest_a_expr_idx', true);
bt_index_check
----------------

(1 row)

ROLLBACK;
-- Check support of both 1B and 4B header sizes of short varlena datum
CREATE TABLE varlena_bug (v text);
ALTER TABLE varlena_bug ALTER column v SET storage plain;
Expand Down
18 changes: 15 additions & 3 deletions contrib/amcheck/sql/check_btree.sql
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,36 @@ INSERT INTO toast_bug SELECT repeat('a', 2200);
SELECT bt_index_check('toasty', true);

--
-- Check that index expressions and predicates are run as the table's owner
-- Check that index expressions and predicates are run as the table's owner,
-- with empty search_path
--
TRUNCATE bttest_a;
INSERT INTO bttest_a SELECT * FROM generate_series(1, 1000);
ALTER TABLE bttest_a OWNER TO regress_bttest_role;
-- A dummy index function checking current_user
CREATE FUNCTION ifun(int8) RETURNS int8 AS $$
BEGIN
ASSERT current_user = 'regress_bttest_role',
ASSERT current_setting('search_path') NOT LIKE '%preempt%',
format('ifun(%s) called with current_schemas %s, search_path %s',
$1, current_schemas(true), current_setting('search_path'));
ASSERT "current_user"() = 'regress_bttest_role',
format('ifun(%s) called by %s', $1, current_user);
RETURN $1;
END;
$$ LANGUAGE plpgsql IMMUTABLE;

CREATE INDEX bttest_a_expr_idx ON bttest_a ((ifun(id) + ifun(0)))
WHERE ifun(id + 10) > ifun(10);

BEGIN;
SET LOCAL check_function_bodies = off;
CREATE SCHEMA preempt;
GRANT USAGE ON SCHEMA preempt TO regress_bttest_role;
SET LOCAL search_path = preempt, pg_catalog, public;
CREATE FUNCTION "current_user"() RETURNS name AS $$
broken
$$ LANGUAGE sql STABLE PARALLEL SAFE STRICT;
SELECT bt_index_check('bttest_a_expr_idx', true);
ROLLBACK;

-- Check support of both 1B and 4B header sizes of short varlena datum
CREATE TABLE varlena_bug (v text);
Expand Down
2 changes: 2 additions & 0 deletions contrib/amcheck/verify_nbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed,
SetUserIdAndSecContext(heaprel->rd_rel->relowner,
save_sec_context | SECURITY_RESTRICTED_OPERATION);
save_nestlevel = NewGUCNestLevel();
set_config_option("search_path", "pg_catalog, pg_temp", PGC_USERSET,
PGC_S_SESSION, GUC_ACTION_SAVE, true, 0, false);
}
else
{
Expand Down
14 changes: 14 additions & 0 deletions contrib/fuzzystrmatch/expected/fuzzystrmatch.out
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ SELECT levenshtein('GUMBO', 'GAMBOL', 2, 1, 1);
3
(1 row)

SELECT levenshtein('GUMBO', 'GAMBOL', 1, 1, 2000000000);
levenshtein
-------------
3
(1 row)

SELECT levenshtein('GUMBO', 'GAMBOL', 2000000000, 2000000000, 2000000000);
ERROR: levenshtein distance out of range
SELECT levenshtein_less_equal('extensive', 'exhaustive', 2);
levenshtein_less_equal
------------------------
Expand All @@ -53,6 +61,12 @@ SELECT levenshtein_less_equal('extensive', 'exhaustive', 4);
4
(1 row)

SELECT levenshtein_less_equal('aaa', 'aaaaa', 1073741824, 0, 1073741824, 10);
levenshtein_less_equal
------------------------
11
(1 row)

SELECT metaphone('GUMBO', 4);
metaphone
-----------
Expand Down
3 changes: 3 additions & 0 deletions contrib/fuzzystrmatch/sql/fuzzystrmatch.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ SELECT soundex(''), difference('', '');

SELECT levenshtein('GUMBO', 'GAMBOL');
SELECT levenshtein('GUMBO', 'GAMBOL', 2, 1, 1);
SELECT levenshtein('GUMBO', 'GAMBOL', 1, 1, 2000000000);
SELECT levenshtein('GUMBO', 'GAMBOL', 2000000000, 2000000000, 2000000000);
SELECT levenshtein_less_equal('extensive', 'exhaustive', 2);
SELECT levenshtein_less_equal('extensive', 'exhaustive', 4);
SELECT levenshtein_less_equal('aaa', 'aaaaa', 1073741824, 0, 1073741824, 10);


SELECT metaphone('GUMBO', 4);
Expand Down
11 changes: 9 additions & 2 deletions contrib/hstore_plperl/hstore_plperl.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ plperl_to_hstore(PG_FUNCTION_ARGS)
errmsg("cannot transform non-hash Perl value to hstore")));
hv = (HV *) in;

pcount = hv_iterinit(hv);
(void) hv_iterinit(hv);

pcount = 64; /* arbitrary initial guess */
pairs = palloc_array(Pairs, pcount);

i = 0;
Expand All @@ -126,6 +127,12 @@ plperl_to_hstore(PG_FUNCTION_ARGS)
char *key = sv2cstr(HeSVKEY_force(he));
SV *value = HeVAL(he);

if (i >= pcount)
{
pcount *= 2;
pairs = repalloc_array(pairs, Pairs, pcount);
}

pairs[i].key = pstrdup(key);
pairs[i].keylen = hstoreCheckKeyLen(strlen(pairs[i].key));
pairs[i].needfree = true;
Expand All @@ -146,7 +153,7 @@ plperl_to_hstore(PG_FUNCTION_ARGS)
i++;
}

pcount = hstoreUniquePairs(pairs, pcount, &buflen);
pcount = hstoreUniquePairs(pairs, i, &buflen);
out = hstorePairs(pairs, pcount, buflen);
PG_RETURN_POINTER(out);
}
4 changes: 2 additions & 2 deletions contrib/pg_trgm/trgm_gist.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ gtrgm_picksplit(PG_FUNCTION_ARGS)
else
size_alpha = SIGLENBIT(siglen) -
sizebitvec((cache[j].allistrue) ? GETSIGN(datum_l) :
GETSIGN(cache[j].sign),
cache[j].sign,
siglen);
}
else
Expand All @@ -910,7 +910,7 @@ gtrgm_picksplit(PG_FUNCTION_ARGS)
else
size_beta = SIGLENBIT(siglen) -
sizebitvec((cache[j].allistrue) ? GETSIGN(datum_r) :
GETSIGN(cache[j].sign),
cache[j].sign,
siglen);
}
else
Expand Down
26 changes: 26 additions & 0 deletions contrib/pgcrypto/expected/pgp-decrypt.out
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,29 @@ UCAAw2JRIISttRHMfDpDuZJpvYo=
'), 'key', 'debug=1');
NOTICE: dbg: parse_compressed_data: bzip2 unsupported
ERROR: Unsupported compression algorithm
-- Check ignore-cipher-failure. This message isn't actually encrypted; it was
-- created with cipher-algo=bf using an OpenSSL that didn't actually support
-- Blowfish. After the fix for CVE-2026-14663, we no longer create these broken
-- ciphertexts, but we allow users to return to the previous behavior during
-- decryption so that the bad wrapper can be stripped.
--
-- Note that if Blowfish is supported by the linked OpenSSL, both decryptions
-- will fail.
select pgp_sym_decrypt(dearmor('
-----BEGIN PGP MESSAGE-----

ww0EBAMC8wIKbtvzJtxi0jABUleCwFJWGCkYKcsNdABqdtXaU2VjcmV0LtMUlnPH3A2QBmZrcucm
1GPb/s2Bkdg=
=6aqD
-----END PGP MESSAGE-----
'), 'wrong key');
ERROR: Wrong key or corrupt data
select pgp_sym_decrypt(dearmor('
-----BEGIN PGP MESSAGE-----

ww0EBAMC8wIKbtvzJtxi0jABUleCwFJWGCkYKcsNdABqdtXaU2VjcmV0LtMUlnPH3A2QBmZrcucm
1GPb/s2Bkdg=
=6aqD
-----END PGP MESSAGE-----
'), 'wrong key', 'ignore-cipher-failure=1');
ERROR: Wrong key or corrupt data
32 changes: 31 additions & 1 deletion contrib/pgcrypto/expected/pgp-decrypt_1.out
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ yA6Ce1QTMK3KdL2MPfamsTUSAML8huCJMwYQFfE=
=JcP+
-----END PGP MESSAGE-----
'), 'foobar');
ERROR: Wrong key or corrupt data
ERROR: encrypt error: Cipher cannot be initialized
select pgp_sym_decrypt(dearmor('
-----BEGIN PGP MESSAGE-----
Comment: dat1.aes.sha1.mdc.s2k3.z0
Expand Down Expand Up @@ -434,3 +434,33 @@ UCAAw2JRIISttRHMfDpDuZJpvYo=
'), 'key', 'debug=1');
NOTICE: dbg: parse_compressed_data: bzip2 unsupported
ERROR: Unsupported compression algorithm
-- Check ignore-cipher-failure. This message isn't actually encrypted; it was
-- created with cipher-algo=bf using an OpenSSL that didn't actually support
-- Blowfish. After the fix for CVE-2026-14663, we no longer create these broken
-- ciphertexts, but we allow users to return to the previous behavior during
-- decryption so that the bad wrapper can be stripped.
--
-- Note that if Blowfish is supported by the linked OpenSSL, both decryptions
-- will fail.
select pgp_sym_decrypt(dearmor('
-----BEGIN PGP MESSAGE-----

ww0EBAMC8wIKbtvzJtxi0jABUleCwFJWGCkYKcsNdABqdtXaU2VjcmV0LtMUlnPH3A2QBmZrcucm
1GPb/s2Bkdg=
=6aqD
-----END PGP MESSAGE-----
'), 'wrong key');
ERROR: encrypt error: Cipher cannot be initialized
select pgp_sym_decrypt(dearmor('
-----BEGIN PGP MESSAGE-----

ww0EBAMC8wIKbtvzJtxi0jABUleCwFJWGCkYKcsNdABqdtXaU2VjcmV0LtMUlnPH3A2QBmZrcucm
1GPb/s2Bkdg=
=6aqD
-----END PGP MESSAGE-----
'), 'wrong key', 'ignore-cipher-failure=1');
pgp_sym_decrypt
-----------------
Secret.
(1 row)

Loading
Loading