mirror of
https://github.com/postgres/postgres.git
synced 2026-06-10 09:10:33 -04:00
Add more tests for corrupted data with pglz_decompress()
Two cases fixed by2b5ba2a0a1were not covered, to emulate the handling of corrupted data, for: - set control bit with a valid 2-byte match tag where offset is 0. - set control bit with a valid 2-byte match tag where offset exceeds output written. Oversight in67d318e704. Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Discussion: https://postgr.es/m/agF4xkIdRcrCIprs@paquier.xyz Backpatch-through: 14
This commit is contained in:
parent
e3c4e37464
commit
5c00f4e2e3
2 changed files with 22 additions and 0 deletions
|
|
@ -42,6 +42,16 @@ SELECT test_pglz_decompress('\x01ff'::bytea, 1024, true);
|
|||
SELECT test_pglz_decompress('\x010f01'::bytea, 1024, false);
|
||||
SELECT test_pglz_decompress('\x010f01'::bytea, 1024, true);
|
||||
|
||||
-- Corrupted compressed data. Set control bit with a valid 2-byte match
|
||||
-- tag where offset exceeds output written.
|
||||
SELECT test_pglz_decompress('\x011001'::bytea, 1024, false);
|
||||
SELECT test_pglz_decompress('\x011001'::bytea, 1024, true);
|
||||
|
||||
-- Corrupted compressed data. Set control bit with a valid 2-byte match
|
||||
-- tag where offset is 0.
|
||||
SELECT test_pglz_decompress('\x010300'::bytea, 1024, false);
|
||||
SELECT test_pglz_decompress('\x010300'::bytea, 1024, true);
|
||||
|
||||
-- Clean up
|
||||
DROP FUNCTION test_pglz_compress;
|
||||
DROP FUNCTION test_pglz_decompress;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,18 @@ SELECT test_pglz_decompress('\x010f01'::bytea, 1024, false);
|
|||
ERROR: pglz_decompress failed
|
||||
SELECT test_pglz_decompress('\x010f01'::bytea, 1024, true);
|
||||
ERROR: pglz_decompress failed
|
||||
-- Corrupted compressed data. Set control bit with a valid 2-byte match
|
||||
-- tag where offset exceeds output written.
|
||||
SELECT test_pglz_decompress('\x011001'::bytea, 1024, false);
|
||||
ERROR: pglz_decompress failed
|
||||
SELECT test_pglz_decompress('\x011001'::bytea, 1024, true);
|
||||
ERROR: pglz_decompress failed
|
||||
-- Corrupted compressed data. Set control bit with a valid 2-byte match
|
||||
-- tag where offset is 0.
|
||||
SELECT test_pglz_decompress('\x010300'::bytea, 1024, false);
|
||||
ERROR: pglz_decompress failed
|
||||
SELECT test_pglz_decompress('\x010300'::bytea, 1024, true);
|
||||
ERROR: pglz_decompress failed
|
||||
-- Clean up
|
||||
DROP FUNCTION test_pglz_compress;
|
||||
DROP FUNCTION test_pglz_decompress;
|
||||
|
|
|
|||
Loading…
Reference in a new issue