Re: [PATCH] Fix segfault calling PQflush on invalid connection

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Fix segfault calling PQflush on invalid connection
Дата
Msg-id 920911.1660578841@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH] Fix segfault calling PQflush on invalid connection  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Список pgsql-bugs
Daniele Varrazzo <daniele.varrazzo@gmail.com> writes:
> After exercising most of the libpq API in psycopg 3, PQflush() seems
> the only one requiring a guard [1]. All the other functions seem to
> behave well when passed an "invalid connection" - aka either a NULL
> pointer or a connection in BAD status.

I went so far as to inspect every function listed in libpq/exports.txt.
All the ones that take a PGconn or PGresult check it for NULL except

PQflush
PQisnonblocking
PQdefaultSSLKeyPassHook_OpenSSL

PQisnonblocking is clearly an oversight, same as PQflush.
Maybe there is a case for not bothering to check in
PQdefaultSSLKeyPassHook_OpenSSL, on the grounds that you'd
not get that far without a connection, but I think for
consistency it should do so too.

There is not a lot of consistency about whether we insist on
the connection being in any particular "good" state.  For
some of the functions I think it's intentional that they should
still work on a failed connection, but I wonder if any of those
are likewise oversights.

            regards, tom lane



В списке pgsql-bugs по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Regression in pipeline mode in libpq 14.5
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17588: RHEL 8 nothing provides libarmadillo.so.10 (64bit) needed by gdal-libs3x*