Re: [BUGS] BUG #14615: ReplicationOriginShmemInit Memory accesscross-border
От | Andres Freund |
---|---|
Тема | Re: [BUGS] BUG #14615: ReplicationOriginShmemInit Memory accesscross-border |
Дата | |
Msg-id | 20170411152049.jus5fmjtqd4g2gdi@alap3.anarazel.de обсуждение исходный текст |
Ответ на | Re: [BUGS] BUG #14615: ReplicationOriginShmemInit Memory access cross-border (Michael Paquier <michael.paquier@gmail.com>) |
Ответы |
Re: [BUGS] BUG #14615: ReplicationOriginShmemInit Memory access cross-border
|
Список | pgsql-bugs |
On 2017-04-10 15:38:56 +0900, Michael Paquier wrote: > diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c > index 5eaf863e02..0aa468789c 100644 > --- a/src/backend/replication/logical/origin.c > +++ b/src/backend/replication/logical/origin.c > @@ -473,7 +473,8 @@ ReplicationOriginShmemInit(void) > > replication_states_ctl->tranche_id = LWTRANCHE_REPLICATION_ORIGIN; > > - MemSet(replication_states, 0, ReplicationOriginShmemSize()); > + MemSet(replication_states, 0, > + mul_size(max_replication_slots, sizeof(ReplicationState))); What's the benefit of using mul_size here? That's usually only beneficial in the original size computation - during use/initialization an actual error should be impossible. To me the right fix seems to be to just do: - replication_states_ctl->tranche_id = LWTRANCHE_REPLICATION_ORIGIN; - - MemSet(replication_states, 0, ReplicationOriginShmemSize()); + MemSet(replication_states_ctl, 0, ReplicationOriginShmemSize()); + + replication_states_ctl->tranche_id = LWTRANCHE_REPLICATION_ORIGIN; No? Greetings, Andres Freund -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
В списке pgsql-bugs по дате отправления: