pgsql: pgcrypto: Detect errors with EVP calls from OpenSSL

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема pgsql: pgcrypto: Detect errors with EVP calls from OpenSSL
Дата
Msg-id E1kmWQF-0005a7-Fz@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
pgcrypto: Detect errors with EVP calls from OpenSSL

The following routines are called within pgcrypto when handling digests
but there were no checks for failures:
- EVP_MD_CTX_size (can fail with -1 as of 3.0.0)
- EVP_MD_CTX_block_size (can fail with -1 as of 3.0.0)
- EVP_DigestInit_ex
- EVP_DigestUpdate
- EVP_DigestFinal_ex

A set of elog(ERROR) is added by this commit to detect such failures,
that should never happen except in the event of a processing failure
internal to OpenSSL.

Note that it would be possible to use ERR_reason_error_string() to get
more context about such errors, but these refer mainly to the internals
of OpenSSL, so it is not really obvious how useful that would be.  This
is left out for simplicity.

Per report from Coverity.  Thanks to Tom Lane for the discussion.

Backpatch-through: 9.5

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d7ecba937b909c26cc266d06261ddaf5a540630e

Modified Files
--------------
contrib/pgcrypto/openssl.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)


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

Предыдущее
От: Andres Freund
Дата:
Сообщение: pgsql: jit: configure: Explicitly reference 'native' component.
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: pgsql: Track total number of WAL records, FPIs and bytes generated in t