Re: Possible null pointer dereference in afterTriggerAddEvent() - Mailing list pgsql-hackers

From Alexander Kuznetsov
Subject Re: Possible null pointer dereference in afterTriggerAddEvent()
Date
Msg-id 8ddb8e6a-e899-4218-870f-8b25da3a9f3f@altlinux.org
Whole thread Raw
In response to Re: Possible null pointer dereference in afterTriggerAddEvent()  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
25.07.2024 20:07, Alvaro Herrera wrote:
> Maybe for sanity (and perhaps for Svace compliance) we could do it the
> other way around, i.e. by testing events->tail for nullness instead of
> events->head, then add the assertion:
>
>         if (events->tail == NULL)
>         {
>             Assert(events->head == NULL);
>             events->head = chunk;
>         }
>         else
>             events->tail->next = chunk;
>
> This way, it's not wholly redundant.
Thanks for your response!
I agree with the proposed changes and have updated the patch accordingly. Version 2 is attached.
> That said, I'm not sure we actually *need* to change this.
I understand and partly agree. But it appears that with these changes, the dereference of a null pointer is impossible
evenin builds where assertions are disabled. Previously, this issue could theoretically occur. Consequently, these
changesslightly enhance overall security.
 

-- 
Best regards,
Alexander Kuznetsov

Attachment

pgsql-hackers by date:

Previous
From: Tender Wang
Date:
Subject: Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails
Next
From: Andreas Karlsson
Date:
Subject: Re: WIP: parallel GiST index builds