Re: BUG #18247: Integer overflow leads to negative width

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Junwang Zhao <zhjwpku@gmail.com>, rekgrpth@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2023-12-19T05:53:59Z
Lists: pgsql-bugs
On Tue, Dec 19, 2023 at 12:08 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Richard Guo <guofenglinux@gmail.com> writes:
> > I agree with all the comments made.  I have also examined other places
> > where the width field is assigned, and I think we've covered all cases.
> > So the v3 patch is in good shape to me.
>
> Thanks for looking!  Do you have an opinion about the int64-vs-double
> question?


To be honest, I don't have a preference on which one is better.  I think
double is good enough for now as we don't need to worry about overflow
with it.

Thanks
Richard

Commits

  1. Prevent integer overflow when forming tuple width estimates.

  2. compute_bitmap_pages' loop_count parameter should be double not int.