test_compression, test module for low-level compression APIs (for 2b5ba2a0a141)

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Cc: Andrew Dunstan <andrew@dunslane.net>
Date: 2026-04-13T00:37:55Z
Lists: pgsql-hackers

Attachments

Hi all,
(Andrew in CC.)

While reading Andrew's commit 2b5ba2a0a141, I was a bit sad to not see
tests for these problems with pglz, applied with the fix down to v14.
Relying on fuzzing is not really cool, because these consume resources
and they may not even hit the correct target, and we want a maximum of
deterministic tests.

And then, I got reminded that one of my pet plugins does something
close to that (used that around 9.5 for some FPW compression
benchmarks):
https://github.com/michaelpq/pg_plugins/tree/main/compress_test

With this infrastructure already at hand, implementing the
problematic tests with corrupted varlenas was a matter of minutes,
leading me to the attached patch (bonus points for check_comprete and
rawsize).

I would like to apply that down to v14, like the previous commit that
has fixed these cases with pglz.  That should come in handy in case
more bugs pop in this area of the code, especially with more
compression methods in mind.

Any objections and/or comments about that?
--
Michael

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add tests for low-level PGLZ [de]compression routines

  2. Fix heap-buffer-overflow in pglz_decompress() on corrupt input.