Fix possible dereference null pointer (src/backend/replication/logical/reorderbuffer.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Fix possible dereference null pointer (src/backend/replication/logical/reorderbuffer.c)
Date: 2024-04-10 18:07:27
Message-ID: CAEudQApm0Kffq4GKLdyogyW1tVbkHOOqWTWg169OTsm1W=FUHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Per Coverity.

The function ReorderBufferTXNByXid,
can return NULL when the parameter *create* is false.

In the functions ReorderBufferSetBaseSnapshot
and ReorderBufferXidHasBaseSnapshot,
the second call to ReorderBufferTXNByXid,
pass false to *create* argument.

In the function ReorderBufferSetBaseSnapshot,
fixed passing true as argument to always return
a valid ReorderBufferTXN pointer.

In the function ReorderBufferXidHasBaseSnapshot,
fixed by checking if the pointer is NULL.

best regards,
Ranier Vilela

Attachment Content-Type Size
fix-possible-dereference-null-pointer-reorderbuffer.patch application/octet-stream 1.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2024-04-10 18:13:02 Re: Table AM Interface Enhancements
Previous Message Tom Lane 2024-04-10 18:06:38 Re: psql: Greatly speed up "\d tablename" when not using regexes