pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix overflow danger in SampleHeapTupleVisible()
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix overflow danger in SampleHeapTupleVisible()
@ 2024-12-18 23:17  Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Melanie Plageman @ 2024-12-18 23:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix overflow danger in SampleHeapTupleVisible()

68d9662be1c4b70 made HeapScanDesc->rs_ntuples unsigned but neglected to
change how it was being used in SampleHeapTupleVisible().

Return early if rs_ntuples is 0 to avoid overflowing and incorrectly
executing the loop code in SampleHeapTupleVisible().

Reported-by: Ranier Vilela
Discussion: https://postgr.es/m/CAEudQAot_xQoZyPZjpj1aBUPrPykY5mOPHGyvfe%3Djz%2BWowdA3A%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/28328ec87b45725f62bed1104d99c8b3220d1675

Modified Files
--------------
src/backend/access/heap/heapam_handler.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)



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

* pgsql: Fix overflow danger in SampleHeapTupleVisible(), take 2
@ 2024-12-20 14:44  Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Melanie Plageman @ 2024-12-20 14:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix overflow danger in SampleHeapTupleVisible(), take 2

28328ec87b45725 addressed one overflow danger in
SampleHeapTupleVisible() but introduced another, albeit a less likely
one. Modify the binary search code to remove this danger.

Reported-by: Richard Guo
Reviewed-by: Richard Guo, Ranier Vilela
Discussion: https://postgr.es/m/CAMbWs4_bE%2BNscChbKWzw6HZOipCUyXfA5133qvoXQ654D3B2gQ%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/94bb6c4410d81ccc019bb60d8aedb73dbc85df76

Modified Files
--------------
src/backend/access/heap/heapam_handler.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)



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


end of thread, other threads:[~2024-12-20 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-12-18 23:17 pgsql: Fix overflow danger in SampleHeapTupleVisible() Melanie Plageman <melanieplageman@gmail.com>
2024-12-20 14:44 pgsql: Fix overflow danger in SampleHeapTupleVisible(), take 2 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