Re: [PATCH] Explicit null dereferenced (src/backend/access/heap/heaptoast.c) - Mailing list pgsql-hackers

From gkokolatos@pm.me
Subject Re: [PATCH] Explicit null dereferenced (src/backend/access/heap/heaptoast.c)
Date
Msg-id 2zIuwcF8JVo_GspzTQrXNXm46G-EwR2XRg9xFAWSoWjGR_2Rn90aJzRp692-eLIS1mgRKn95TJdCQZN2hdrTj0agUyhypmz9izCw4EiE6Ms=@pm.me
Whole thread Raw
In response to [PATCH] Explicit null dereferenced (src/backend/access/heap/heaptoast.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: [PATCH] Explicit null dereferenced (src/backend/access/heap/heaptoast.c)
List pgsql-hackers




‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, 28 August 2020 03:22, Ranier Vilela <ranier.vf@gmail.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
unconditionallyset ttc_flags to zero so the flag bit set in the patch will be erased anyways. This patch may make
coverityhappy 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
actuallyinspected 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





pgsql-hackers by date:

Previous
From: Sachin Khanna
Date:
Subject: RE: Please help for error ( file is required for XML support )
Next
From: Masahiro Ikeda
Date:
Subject: Re: Display individual query in pg_stat_activity