Re: BUG #3571: call to decrypt causes segfault

Поиск
Список
Период
Сортировка
От Marko Kreen
Тема Re: BUG #3571: call to decrypt causes segfault
Дата
Msg-id e51f66da0708230154j7cfc06c4xd18a5a2069cbfead@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #3571: call to decrypt causes segfault  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #3571: call to decrypt causes segfault  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On 8/23/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Ken Colson" <ken.colson@sage.com> writes:
> > this statement:
> > select decrypt(''::bytea,'password','bf')
> > causes the postgresql backend to crash:
> > This seems to be a 64bit problem.
>
> Reproduced here in HEAD.  The problem is here:

> 293                     pad = res[*rlen - 1];

> The problem clearly is that combo_decrypt()'s depadding code fails to
> consider the possibility of a zero-length input, but I'm not entirely
> sure how far up the food chain we ought to fix it --- perhaps
> pg_decrypt() should not have bothered to light up the decryptor at all?

The fix should be in combo_decrypt() because other code
should not need to guess whether zero-length input is
allowed or not.

Patch attached.

> Also, what other pgcrypto routines might have similar bugs?

Well, PGP code accesses anything thru wrappers, so should be OK.
Rest of the code does not try to parse user data, just passes
it thru.

Except armor()/dearmor(), which does lot of pointer-juggling.
I can do a review of that, just in case.

--
marko

Вложения

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

Предыдущее
От: Zdenek Kotala
Дата:
Сообщение: Re: BUG #3567: invalid page header in block XXXXof relation
Следующее
От: Dave Page
Дата:
Сообщение: Cannot create a type in pg_catalog