Re: BUG #18830: ExecInitMerge Segfault on MERGE - Mailing list pgsql-bugs

From Amit Langote
Subject Re: BUG #18830: ExecInitMerge Segfault on MERGE
Date
Msg-id CA+HiwqH98Fvpw-OQYz86aDhznhTaxtVq-Etdnq3eFts+pXcFBw@mail.gmail.com
Whole thread Raw
In response to Re: BUG #18830: ExecInitMerge Segfault on MERGE  (Tender Wang <tndrwang@gmail.com>)
Responses Re: BUG #18830: ExecInitMerge Segfault on MERGE
List pgsql-bugs
On Mon, Mar 3, 2025 at 9:16 PM Tender Wang <tndrwang@gmail.com> wrote:
> nrels = list_length(resultRelations);
> ...
> mtstate->resultRelInfo = (ResultRelInfo *)
>               palloc(nrels * sizeof(ResultRelInfo));
>
> The memory of mtstate->resultRelInfo point to is undefined. When we access its memory in ExecInitMerge(),

This needs to be fixed saparately.

> relationDesc = RelationGetDescr(resultRelInfo->ri_RelationDesc);
>
> crash happened.

Do you have a case where this access to undefined
ModifyTableState.resultRelInfo occurs? I would have thought that it
should not happen.

--
Thanks, Amit Langote



pgsql-bugs by date:

Previous
From: Amit Langote
Date:
Subject: Re: BUG #18830: ExecInitMerge Segfault on MERGE
Next
From: Tender Wang
Date:
Subject: Re: BUG #18830: ExecInitMerge Segfault on MERGE