Re: issue in pgfdw_report_error()?
Fujii Masao <masao.fujii@oss.nttdata.com>
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-11-19T15:18:15Z
Lists: pgsql-hackers
Attachments
- pgfdw_report_error_v1.patch (text/plain) patch v1
On 2021/11/19 21:57, Bharath Rupireddy wrote:
>> If this is a bug, IMO the following change needs to be applied. Thought?
>>
>> -------------------
>> ereport(elevel,
>> (errcode(sqlstate),
>> - message_primary ? errmsg_internal("%s", message_primary) :
>> + (message_primary != NULL && message_primary[0] != '\0') ?
>> + errmsg_internal("%s", message_primary) :
>> errmsg("could not obtain message string for remote error"),
>> -------------------
I attached the patch.
> What if conn->errorMessage.data is NULL and PQerrorMessage returns it?
> The message_primary can still be NULL right?
Since conn->errorMessage is initialized by initPQExpBuffer(),
PQerrorMessage() seems not to return NULL. But *if* it returns NULL,
pchomp(NULL) is executed and would cause a segmentation fault.
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
Commits
-
postgres_fdw: Fix unexpected reporting of empty message.
- 429faf9ed52d 10.20 landed
- 82d1e1334498 11.15 landed
- 21a86b0eba64 12.10 landed
- f89015b63f53 13.6 landed
- 5cb86a2622f6 14.2 landed
- 557c39bba925 15.0 landed