Re: When is int32 not an int32?

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: When is int32 not an int32?
Дата
Msg-id 04B7B087-8347-4931-9EC2-CFD8883852C6@justatheory.com
обсуждение исходный текст
Ответ на Re: When is int32 not an int32?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: When is int32 not an int32?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sep 26, 2021, at 18:31, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> I'd bet more along the lines of "your overflow check is less portable than
> you thought”.

Oh well now that you mention it and I look past things, I see we’re using INT_MAX, but should probably use INT32_MAX.

  https://github.com/theory/pg-semver/blob/87cc30cbe80aa3992a4af6f19a35a9441111a86c/src/semver.c#L145-L149

And also that the destination value we’re storing it in is an int parts[], not int32 parts[]. Which we do so we can
parsenumbers up to int size. But to Fetter’s point, we’re not properly handling something greater than int (usually
int64,presumably). Not sure what changes are required to improve memory safety over and above using INT32_MAX instead
ofINT_MAX. 

Thanks,

Daavid


Вложения

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

Предыдущее
От: Chapman Flack
Дата:
Сообщение: Re: Add create and update timestamp to all objects
Следующее
От: Tom Lane
Дата:
Сообщение: Re: When is int32 not an int32?