From: Michael Paquier Date: Mon, 25 May 2026 05:38:02 +0000 (+0900) Subject: Fix size check in statext_dependencies_deserialize() X-Git-Tag: REL_19_BETA1~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b8fa5fd37b193c46a03aa5d2838f2c6af973782;p=thirdparty%2Fpostgresql.git Fix size check in statext_dependencies_deserialize() 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 Discussion: https://postgr.es/m/4b8d299d-2505-4c30-bf80-0f697410db35@tantorlabs.com Backpatch-through: 14 --- diff --git a/src/backend/statistics/dependencies.c b/src/backend/statistics/dependencies.c index e3a2f5817e0..95dcc218978 100644 --- a/src/backend/statistics/dependencies.c +++ b/src/backend/statistics/dependencies.c @@ -529,7 +529,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 %zu (expected at least %zu)",