Fix incorrect size check in statext_dependencies_deserialize - Mailing list pgsql-hackers

From Ilia Evdokimov
Subject Fix incorrect size check in statext_dependencies_deserialize
Date
Msg-id 4b8d299d-2505-4c30-bf80-0f697410db35@tantorlabs.com
Whole thread
Responses Don't use pq_putmessage in socket comm function
List pgsql-hackers
Hi hackers,

I noticed an issue in `statext_dependencies_deserialize()`. The sanity 
check uses `SizeOfItem` to validate the bytea size, but `SizeOfItem()` 
expects the number of attributes in a single dependency, not the number 
of dependencies. This means the check is computing the size of one 
dependency with ndeps attributes, which is incorrect.

It should use `MinSizeOfItems` instead, which correctly computes the 
minimum expected size as the header plus `ndeps` minimally-sized 
dependency items.

Notably, the similar function for ndistinct extended statistics 
`statext_ndistinct_deserialize()` already uses `MinSizeOfItems` 
correctly, which suggests this is a typo rather than an intentional choice.

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC,
https://tantorlabs.com/

Attachment

pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication
Next
From: Ayush Tiwari
Date:
Subject: Re: [Bug]Assertion failure in LATERAL GRAPH_TABLE with multi-label pattern