Re: BUG #2260: PGCrypto Memory Problem

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #2260: PGCrypto Memory Problem
Дата
Msg-id 19064.1140033765@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #2260: PGCrypto Memory Problem  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: BUG #2260: PGCrypto Memory Problem  (Marko Kreen <marko@l-t.ee>)
Список pgsql-bugs
Michael Fuhr <mike@fuhr.org> writes:
> My non-OpenSSL build shows no memory leak, so the leak and OpenSSL
> seem to be correlated.  I'd be more inclined to suspect a bug in
> pgcrypto's OpenSSL-specific code than in OpenSSL itself.  Will keep
> digging.

The problem appears to be here:

static void
digest_finish(PX_MD * h, uint8 *dst)
{
    EVP_MD_CTX *ctx = (EVP_MD_CTX *) h->p.ptr;
    const EVP_MD *md = EVP_MD_CTX_md(ctx);

    EVP_DigestFinal(ctx, dst, NULL);

    /*
     * Some builds of 0.9.7x clear all of ctx in EVP_DigestFinal. Fix it by
     * reinitializing ctx.
     */
    EVP_DigestInit(ctx, md);
}

It looks like this results in a leak of the entire OpenSSL context for
each call to pg_crypt.  Marko, I trust you've got a better solution for
this ...

            regards, tom lane

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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: BUG #2260: PGCrypto Memory Problem
Следующее
От: Daniel Blaisdell
Дата:
Сообщение: Re: BUG #2260: PGCrypto Memory Problem