Re: [PATCH] Fix memory corruption in pg_shdepend.c - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: [PATCH] Fix memory corruption in pg_shdepend.c
Date
Msg-id CAJ7c6TN5AwbGXXm0qS4yBfzJnaY6_OHPCJ_ZCy-C6yP2T_7j=Q@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Fix memory corruption in pg_shdepend.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] Fix memory corruption in pg_shdepend.c  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Hi Tom,

> BTW, I think there is an additional bug in copyTemplateDependencies:
> I do not see it initializing slot->tts_isnull[] anywhere.  It
> probably accidentally works (at least in devel builds) because we zero
> that memory somewhere else, but surely this code shouldn't assume that?

tts_isnull[] is zeroed in:
- copyTemplateDependencies
-- MakeSingleTupleTableSlot, which simply wraps:
--- MakeTupleTableSlot

... where the slot is allocated with palloc0. The assumption that
MakeSingleTupleTableSlot() returns valid TupleTableSlot* with zeroed
tts_isnull[] seems reasonable, no?

What confuses me is the fact that we have two procedures that do the
same thing. Maybe one is redundant.

-- 
Best regards,
Aleksander Alekseev



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Added schema level support for publication.
Next
From: Rafia Sabih
Date:
Subject: Add connection active, idle time to pg_stat_activity