Re: [PATCH] Add error handling to byteaout.

From: Andreas Seltenreich <andreas(dot)seltenreich(at)credativ(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Add error handling to byteaout.
Date: 2015-06-02 16:47:54
Message-ID: 87lhg2dpl1.fsf@oort.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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...

Anyway, my motivation for the patch was the improved error reporting.
Is the drive-by type change a problem here?

regards,
Andreas

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2015-06-02 16:53:56 Re: Missing "-i / --ignore-version" in pg_dump help
Previous Message Robert Haas 2015-06-02 16:05:47 Re: WIP: Enhanced ALTER OPERATOR