postgres.git / summary / log / commit / refs

commit    0445c7667e3c45eb8c3bafa4bb0ffbdc090d75e9
Author:   Michael Paquier <michael@paquier.xyz>
Date:     Mon May 25 05:39:04 2026 +0000
First released in: 14.24, 15.19, 16.15, 17.11, 18.6

    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 <ilya.evdokimov@tantorlabs.com>
    Discussion: https://postgr.es/m/4b8d299d-2505-4c30-bf80-0f697410db35@tantorlabs.com
    Backpatch-through: 14


src/backend/statistics/dependencies.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/statistics/dependencies.c b/src/backend/statistics/dependencies.c index edb2e5347d4..8837fc73f74 100644 --- a/src/backend/statistics/dependencies.c +++ b/src/backend/statistics/dependencies.c @@ -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 %zu (expected at least %zu)", [parent: e037a4199617]