Re: glibc qsort() vulnerability

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: glibc qsort() vulnerability
Дата
Msg-id 20240209200828.GB665650@nathanxps13
обсуждение исходный текст
Ответ на Re: glibc qsort() vulnerability  (Mats Kindahl <mats@timescale.com>)
Ответы Re: glibc qsort() vulnerability  (Mats Kindahl <mats@timescale.com>)
Список pgsql-hackers
On Fri, Feb 09, 2024 at 08:43:21PM +0100, Mats Kindahl wrote:
> QQ: right now it looks like this:
> 
> static inline int
> pg_cmp_u16(uint16 a, uint16 b)
> {
> 
> return (int32)a - (int32)b;
> 
> }
> 
> 
> and
> 
> static inline int
> pg_cmp_u32(uint32 a, uint32 b)
> {
> 
> return (a > b) - (a < b);
> 
> }
> 
> 
> I think that is clear enough, but do you want more casts added for the
> return value as well?

I think that is reasonably clear.  The latter does require you to know that
< and > return (int) 0 or (int) 1, which might be worth a short comment.
But that's just nitpicking...

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: glibc qsort() vulnerability
Следующее
От: Alexander Korotkov
Дата:
Сообщение: Re: Add semi-join pushdown to postgres_fdw