pgsql: Fix overflow danger in SampleHeapTupleVisible(), take 2

2024-12-20 Thread Melanie Plageman
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

pgsql: Fix overflow danger in SampleHeapTupleVisible()

2024-12-18 Thread Melanie Plageman
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(