]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix size check in statext_dependencies_deserialize()
authorMichael Paquier <michael@paquier.xyz>
Mon, 25 May 2026 05:39:06 +0000 (14:39 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 25 May 2026 05:39:06 +0000 (14:39 +0900)
The check for the minimum expected bytea size of a MVDependencies object
was using SizeOfItem() for its calculation.  This macro uses the number
of attributes in a single dependency.

This minimum size calculation should be based on MinSizeOfItems(), that
computes the minimum expected size as the header plus the
minimally-sized number of dependency items.

Oversight in d08c44f7a4ec.

Author: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>
Discussion: https://postgr.es/m/4b8d299d-2505-4c30-bf80-0f697410db35@tantorlabs.com
Backpatch-through: 14

src/backend/statistics/dependencies.c

index 0d0644c36565be0acd7b6fc7f2c00a96f9a1f323..d1aef344b32a16f4e1b3b44d0d18030b4822ae2c 100644 (file)
@@ -538,7 +538,7 @@ statext_dependencies_deserialize(bytea *data)
                elog(ERROR, "invalid zero-length item array in MVDependencies");
 
        /* what minimum bytea size do we expect for those parameters */
-       min_expected_size = SizeOfItem(dependencies->ndeps);
+       min_expected_size = MinSizeOfItems(dependencies->ndeps);
 
        if (VARSIZE_ANY_EXHDR(data) < min_expected_size)
                elog(ERROR, "invalid dependencies size %zd (expected at least %zd)",