Re: BUG #18888: /src/interfaces/ecpg/preproc/descriptor.c possible NULL dereference

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: Даниил Элишаков <dan-eli(at)mail(dot)ru>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18888: /src/interfaces/ecpg/preproc/descriptor.c possible NULL dereference
Date: 2025-04-10 18:17:17
Message-ID: bfdf6ae4-7d27-4a1c-99b3-b6307637f106@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Apr 10, 2025, at 1:39 PM, PG Bug reporting form wrote:
> On 203 and 313 lines It seems that a struct data type should not be used in
> 'EXEC SQL SET DESCRIPTOR' command, so the code in question should never be
> executed and it is not a problem. However there are no actual checks for
> corrrectess of the provided data type. It is required to add a check against
> wrong data types supplied by the user.

Which struct data type? struct variable?

Did you read find_variable()? At the end, it has

if (p == NULL)
mmfatal(PARSE_ERROR, "variable \"%s\" is not declared", name);

return p;

mmfatal() is marked as noreturn so it is not possible that find_variable()
returns NULL. Hence, struct variable *v is always a valid pointer.

If you're directly opening bug reports based on a static analyzer output
without a previous analysis, don't do that. These SATs generally report lots of
false positives. Instead, investigate each report and (if possible) create a
reproducible test case demonstrating that it is a real issue.

--
Euler Taveira
EDB https://www.enterprisedb.com/

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-04-10 18:19:52 Re: BUG #18889: /src/backend/utils/adt/network.c condition is always false
Previous Message Tom Lane 2025-04-10 18:04:39 Re: BUG #18891: /src/include/lib/simplehash.h possible palloc0 problems