Re: Implementing setBinaryStream(int, InputStream, long)

Поиск
Список
Период
Сортировка
От Johann 'Myrkraverk' Oskarsson
Тема Re: Implementing setBinaryStream(int, InputStream, long)
Дата
Msg-id oc9wtm.x5oc9wtm.wr3n.qgjt.gnus@asuka.myrkraverk.com
обсуждение исходный текст
Ответ на Re: Implementing setBinaryStream(int, InputStream, long)  (Dave Cramer <pg@fastcrypt.com>)
Список pgsql-jdbc
Dave Cramer <pg@fastcrypt.com> writes:

> Johann,
>
> I've committed the patch with a small formatting difference.

Thank you.

> Also it would be nice if a test case came with this patch.
> Dave Cramer

I'll do that soon, maybe today.

>>>     if (length > Integer.MAX_VALUE)

Here I'm a bit concerned the test should be

    if ( length > Integer.MAX_VALUE || length < 0 )

since "small enough" negative long values will become positive integers
during the cast.

The question is "how much do we hold the user's hands?"  Consider an
infinite stream such as /dev/random with a length of
(long)Integer.MIN_VALUE - 1L.

Here I'm not at all concerned with negative values passed to setBytea()
- handling that is setBytea()'s problem.

Of course we can also test for length < Integer.MIN_VALUE but does it
ever make sense to upload negative length streams?

I can throw in a patch for that when I deliver a unit test, if wanted.


--
   Johann Oskarsson                http://www.2ndquadrant.com/    |[]
   PostgreSQL Development, 24x7 Support, Training and Services  --+--
                                                                  |
   Blog: http://my.opera.com/myrkraverk/blog/

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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: REL9_2_DEVEL
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: REL9_2_DEVEL