Re: [PATCH] Explicit null dereferenced (src/backend/access/heap/heaptoast.c)

From: gkokolatos(at)pm(dot)me
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Explicit null dereferenced (src/backend/access/heap/heaptoast.c)
Date: 2020-08-28 07:44:50
Message-ID: 2zIuwcF8JVo_GspzTQrXNXm46G-EwR2XRg9xFAWSoWjGR_2Rn90aJzRp692-eLIS1mgRKn95TJdCQZN2hdrTj0agUyhypmz9izCw4EiE6Ms=@pm.me
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, 28 August 2020 03:22, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:

> Hi,
>
> Per Coverity.
>
> When "Prepare for toasting", it is necessary to turn off the flag TOAST_NEEDS_DELETE_OLD,
> if there is no need to delete external values from the old tuple, otherwise,
> there are dereference NULL at toast_helper.c (on toast_tuple_cleanup function).
>

Excuse my ignorance, isn't this a false positive?

Regardless right after prepare for toasting, a call to toast_tuple_init is made which will explicitly and unconditionally set ttc_flags to zero so the flag bit set in the patch will be erased anyways. This patch may make coverity happy but does not really change anything in the behaviour of the code.

Furthermore, in the same function, toast_tuple_init, the flag is set to TOAST_NEEDS_DELETE_OLD after the old value is actually inspected and found to not be null, be stored on disk and to be different than the new value. To my understanding, this seems to be correct.

Can you please explain to me what I am missing?

//Georgios

> regards,
> Ranier Vilela

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiro Ikeda 2020-08-28 08:06:12 Re: Display individual query in pg_stat_activity
Previous Message Sachin Khanna 2020-08-28 07:36:48 RE: Please help for error ( file <libxml/parser.h> is required for XML support )