From: | Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me> |
---|---|
To: | Andreas Seltenreich <andreas(dot)seltenreich(at)credativ(dot)de> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCH] Add error handling to byteaout. |
Date: | 2015-06-03 16:23:24 |
Message-ID: | BLU436-SMTP983AFC5FD940DB59E9C311F2B40@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 06/02/2015 06:47 PM, Andreas Seltenreich wrote:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>
>> Andreas Seltenreich <andreas(dot)seltenreich(at)credativ(dot)de> writes:
>>> The scary one is due to an integer overflow the attached patch also
>>> fixes.
>>
>> s/int/Size/ doesn't fix anything on 32-bit machines.
>
> Well, it changes the signedness of the computation on 32-bit, and in
> combination with the fact that "len" is always smaller than 2^32, but
> may exceed 2^31-1, the change avoids the dependency on the undefined
> behavior of signed integer overflows in C on 32-bit as well. But I
> admit that this might be a rather academic point...
>
Postgres requires twos-complement representation, so that the assumption
that signed integer types wrap around on overflow can be safely made.
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2015-06-03 16:32:38 | Re: [PATCH] Add error handling to byteaout. |
Previous Message | Joshua D. Drake | 2015-06-03 14:51:56 | Re: Restore-reliability mode |