- Notifications
You must be signed in to change notification settings - Fork67
CVE-2020-14350#222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
CVE-2020-14350#222
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
3 changes: 2 additions & 1 deletionMakefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
22 changes: 15 additions & 7 deletionsREADME.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletionsexpected/pathman_CVE-2020-14350.out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* Check fix for CVE-2020-14350. | ||
* See also 7eeb1d986 postgresql commit. | ||
*/ | ||
SET client_min_messages = 'warning'; | ||
DROP FUNCTION IF EXISTS _partition_data_concurrent(oid,integer); | ||
DROP FUNCTION IF EXISTS create_single_range_partition(TEXT,ANYELEMENT,ANYELEMENT,TEXT); | ||
DROP TABLE IF EXISTS test1 CASCADE; | ||
DROP TABLE IF EXISTS test2 CASCADE; | ||
DROP ROLE IF EXISTS regress_hacker; | ||
SET client_min_messages = 'notice'; | ||
CREATE EXTENSION pg_pathman; | ||
CREATE ROLE regress_hacker LOGIN; | ||
-- Test 1 | ||
RESET ROLE; | ||
ALTER ROLE regress_hacker NOSUPERUSER; | ||
SET ROLE regress_hacker; | ||
SHOW is_superuser; | ||
is_superuser | ||
-------------- | ||
off | ||
(1 row) | ||
CREATE FUNCTION _partition_data_concurrent(relation oid, p_limit INT, OUT p_total BIGINT) | ||
RETURNS bigint | ||
AS $$ | ||
BEGIN | ||
ALTER ROLE regress_hacker SUPERUSER; | ||
SELECT _partition_data_concurrent(relation, NULL::text, NULL::text, p_limit) INTO p_total; | ||
END | ||
$$ LANGUAGE plpgsql; | ||
CREATE TABLE test1(i INT4 NOT NULL); | ||
INSERT INTO test1 SELECT generate_series(1, 500); | ||
SELECT create_hash_partitions('test1', 'i', 5, false); | ||
create_hash_partitions | ||
------------------------ | ||
5 | ||
(1 row) | ||
RESET ROLE; | ||
SELECT partition_table_concurrently('test1', 10, 1); | ||
NOTICE: worker started, you can stop it with the following command: select public.stop_concurrent_part_task('test1'); | ||
partition_table_concurrently | ||
------------------------------ | ||
(1 row) | ||
SELECT pg_sleep(1); | ||
pg_sleep | ||
---------- | ||
(1 row) | ||
-- Test result (must be 'off') | ||
SET ROLE regress_hacker; | ||
SHOW is_superuser; | ||
is_superuser | ||
-------------- | ||
off | ||
(1 row) | ||
-- Test 2 | ||
RESET ROLE; | ||
ALTER ROLE regress_hacker NOSUPERUSER; | ||
SET ROLE regress_hacker; | ||
SHOW is_superuser; | ||
is_superuser | ||
-------------- | ||
off | ||
(1 row) | ||
CREATE FUNCTION create_single_range_partition(parent_relid TEXT, start_value ANYELEMENT, end_value ANYELEMENT, partition_name TEXT) | ||
RETURNS REGCLASS | ||
AS $$ | ||
BEGIN | ||
ALTER ROLE regress_hacker SUPERUSER; | ||
RETURN create_single_range_partition(parent_relid, start_value, end_value, partition_name, NULL::text); | ||
END | ||
$$ LANGUAGE plpgsql; | ||
RESET ROLE; | ||
CREATE TABLE test2(i INT4 NOT NULL); | ||
INSERT INTO test2 VALUES(0); | ||
SELECT create_range_partitions('test2', 'i', 0, 1); | ||
create_range_partitions | ||
------------------------- | ||
1 | ||
(1 row) | ||
INSERT INTO test2 values(1); | ||
-- Test result (must be 'off') | ||
SET ROLE regress_hacker; | ||
SHOW is_superuser; | ||
is_superuser | ||
-------------- | ||
off | ||
(1 row) | ||
-- Cleanup | ||
RESET ROLE; | ||
DROP FUNCTION _partition_data_concurrent(oid,integer); | ||
DROP FUNCTION create_single_range_partition(TEXT,ANYELEMENT,ANYELEMENT,TEXT); | ||
DROP TABLE test1 CASCADE; | ||
NOTICE: drop cascades to 5 other objects | ||
DETAIL: drop cascades to table test1_0 | ||
drop cascades to table test1_1 | ||
drop cascades to table test1_2 | ||
drop cascades to table test1_3 | ||
drop cascades to table test1_4 | ||
DROP TABLE test2 CASCADE; | ||
NOTICE: drop cascades to 3 other objects | ||
DETAIL: drop cascades to sequence test2_seq | ||
drop cascades to table test2_1 | ||
drop cascades to table test2_2 | ||
DROP ROLE regress_hacker; | ||
DROP EXTENSION pg_pathman; |
22 changes: 11 additions & 11 deletionshash.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.