pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid overflow computing visibility map length
4+ messages / 1 participants
[nested] [flat]

* pgsql: Avoid overflow computing visibility map length
@ 2026-11-19 22:16  Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Melanie Plageman @ 2026-11-19 22:16 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid overflow computing visibility map length

Computing the number of visibility map blocks used addition-based
ceiling division on a BlockNumber.  For heap lengths near MaxBlockNumber
on 32-bit builds, the addition could overflow and produce a much smaller
visibility map length, potentially zero.

Use quotient and remainder instead so the calculation cannot overflow.

Reported-by: Melanie Plageman <melanieplageman@gmail.com>
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0bfb84006e3ef2f6826e91e374b5379cc4d4a481

Modified Files
--------------
src/backend/access/heap/visibilitymap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Avoid overflow computing visibility map length
@ 2026-11-19 22:17  Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Melanie Plageman @ 2026-11-19 22:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid overflow computing visibility map length

Computing the number of visibility map blocks used addition-based
ceiling division on a BlockNumber.  For heap lengths near MaxBlockNumber
on 32-bit builds, the addition could overflow and produce a much smaller
visibility map length, potentially zero.

Use quotient and remainder instead so the calculation cannot overflow.

Reported-by: Melanie Plageman <melanieplageman@gmail.com>
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Backpatch-through: 17

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e91c07e28348fb33d7acee7922c889dd7e205394

Modified Files
--------------
src/backend/access/heap/visibilitymap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Avoid overflow computing visibility map length
@ 2026-11-19 22:18  Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Melanie Plageman @ 2026-11-19 22:18 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid overflow computing visibility map length

Computing the number of visibility map blocks used addition-based
ceiling division on a BlockNumber.  For heap lengths near MaxBlockNumber
on 32-bit builds, the addition could overflow and produce a much smaller
visibility map length, potentially zero.

Use quotient and remainder instead so the calculation cannot overflow.

Reported-by: Melanie Plageman <melanieplageman@gmail.com>
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Backpatch-through: 17

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a20d58b47f18f2085f5fadb553e56a8e9fa3160b

Modified Files
--------------
src/backend/access/heap/visibilitymap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Avoid overflow computing visibility map length
@ 2026-11-19 22:22  Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Melanie Plageman @ 2026-11-19 22:22 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid overflow computing visibility map length

Computing the number of visibility map blocks used addition-based
ceiling division on a BlockNumber.  For heap lengths near MaxBlockNumber
on 32-bit builds, the addition could overflow and produce a much smaller
visibility map length, potentially zero.

Use quotient and remainder instead so the calculation cannot overflow.

Reported-by: Melanie Plageman <melanieplageman@gmail.com>
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Backpatch-through: 17

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1b51ce7c9ded8d52ee0c5ba50be24f89536b262b

Modified Files
--------------
src/backend/access/heap/visibilitymap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-11-19 22:22 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 22:16 pgsql: Avoid overflow computing visibility map length Melanie Plageman <melanieplageman@gmail.com>
2026-11-19 22:17 pgsql: Avoid overflow computing visibility map length Melanie Plageman <melanieplageman@gmail.com>
2026-11-19 22:18 pgsql: Avoid overflow computing visibility map length Melanie Plageman <melanieplageman@gmail.com>
2026-11-19 22:22 pgsql: Avoid overflow computing visibility map length Melanie Plageman <melanieplageman@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox