Possible NULL dereferencing (src/backend/tcop/pquery.c) - Mailing list pgsql-hackers

From Ranier Vilela
Subject Possible NULL dereferencing (src/backend/tcop/pquery.c)
Date
Msg-id CAEudQAppKDbMi=mijz9ayFpj4x0VQg9ZcHVK2F90VKM7ozqyfA@mail.gmail.com
Whole thread Raw
Responses Re: Possible NULL dereferencing (src/backend/tcop/pquery.c)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

Per Coverity.
Perhaps it is excessive caution.
Probably assertion check has already caught all possible errors.
But, redundancy may not cost as much and is worth it.

1.Assertion check
/* Caller messed up if we have neither a ready query nor held data. */
Assert(queryDesc || portal->holdStore);

But in release, if QueryDesc is NULL and portal->holdStore is NULL too,
when Call PushActiveSnapshot  deference NULL check can happen.

2. if (portal->atEnd || count <= 0) is True
No need to recheck count against FETCH_ALL.

Is it worth correcting them?

regards,
Ranier Vilela
Attachment

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: pg_dump bug for extension owned tables
Next
From: Tomas Vondra
Date:
Subject: Re: Default setting for enable_hashagg_disk