public inbox for [email protected]
help / color / mirror / Atom feedFrom: Richard Guo <[email protected]>
To: Tender Wang <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: BUG #19405: Assertion in eval_windowaggregates() fails due to integer overflow
Date: Fri, 10 Apr 2026 18:24:14 +0900
Message-ID: <CAMbWs4-1J+WQFVR9=+gCgqugxoS=ecjiQ2t5GfLGDUgG7X2uqA@mail.gmail.com> (raw)
In-Reply-To: <CAMbWs48QRWz7y52kGTwdSDYcerb_9FdCczJG3-_=RAQz0cNMOw@mail.gmail.com>
References: <[email protected]>
<CAMbWs4_GnG0NYnsBZJpHG-BLo28euD6VUx0WhFd4Ur6RaLr5WQ@mail.gmail.com>
<CAHewXNnpM95Zg8ARhZwO87_6+4+ag5iBYhoaOJ0TAD_-ygm9tg@mail.gmail.com>
<CAMbWs4-stRKsWK6JXYn1eaR1JJzxAeF7QULQ-=0mJFX9k4RFzA@mail.gmail.com>
<CAMbWs48QRWz7y52kGTwdSDYcerb_9FdCczJG3-_=RAQz0cNMOw@mail.gmail.com>
On Wed, Apr 8, 2026 at 6:42 PM Richard Guo <[email protected]> wrote:
> Here is the updated patch. I've added test cases for GROUPS mode with
> an overflow-inducing offset. These don't seem to produce visibly
> wrong results without the patch. I believe that is because the
> incremental nature of group pointer advancement happens to mask the
> misbehavior. But I think they are still worth having since signed
> integer overflow is undefined behavior in C.
>
> Regarding performance, I don't think this should be a concern.
> pg_add_s64_overflow compiles down to a native add+jo sequence on
> platforms with __builtin_add_overflow, and falls back to a couple of
> inlined comparisons on others. Either way, the cost seems negligible
> next to the per-row tuple store and aggregation work these functions
> already do.
I forgot to mention that I've committed and back-patched this fix.
- Richard
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: BUG #19405: Assertion in eval_windowaggregates() fails due to integer overflow
In-Reply-To: <CAMbWs4-1J+WQFVR9=+gCgqugxoS=ecjiQ2t5GfLGDUgG7X2uqA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox