Check for tuplestorestate nullness before dereferencing

From: Alexander Kuznetsov <kuznetsovam(at)altlinux(dot)org>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: nickel(at)altlinux(dot)org, egori(at)altlinux(dot)org
Subject: Check for tuplestorestate nullness before dereferencing
Date: 2024-10-14 09:25:50
Message-ID: 883c0a60-b9d1-463c-b8e2-8c29f702646b@altlinux.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello everyone,

I'd like to propose adding a check for the nullness of tuplestorestate before dereferencing it
in src/backend/executor/nodeModifier.c. The patch is attached.

I am proposing this fix based on the assumption that tuplestorestate could be NULL
since there is a check for it when calculating eof_tuplestore at line 85.
However, since this code hasn't been changed since 2006 and hasn't caused any issues,
it is possible that the check for (tuplestorestate == NULL) is redundant when calculating eof_tuplestore.

--
Best regards,
Alexander Kuznetsov

Attachment Content-Type Size
0001-Check-for-tuplestorestate-nullness-before-dereferenc.patch text/x-patch 1.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-10-14 09:28:41 Re: Enable data checksums by default
Previous Message Dean Rasheed 2024-10-14 09:21:31 Re: Adding OLD/NEW support to RETURNING