Skip to content

Commit 6765a2c

Browse files
committed
Fix incorrect loop counts in tidbitmap.c.
A couple of places that should have been iterating over WORDS_PER_CHUNK words were iterating over WORDS_PER_PAGE words instead. This thinko accidentally failed to fail, because (at least on common architectures with default BLCKSZ) WORDS_PER_CHUNK is a bit less than WORDS_PER_PAGE, and the extra words being looked at were always zero so nothing happened. Still, it's a bug waiting to happen if anybody ever fools with the parameters affecting TIDBitmap sizes, and it's a small waste of cycles too. So back-patch to all active branches. Etsuro Fujita
1 parent 0d6a006 commit 6765a2c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/nodes/tidbitmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ tbm_union_page(TIDBitmap *a, const PagetableEntry *bpage)
362362
if (bpage->ischunk)
363363
{
364364
/* Scan b's chunk, mark each indicated page lossy in a */
365-
for (wordnum = 0; wordnum < WORDS_PER_PAGE; wordnum++)
365+
for (wordnum = 0; wordnum < WORDS_PER_CHUNK; wordnum++)
366366
{
367367
bitmapword w = bpage->words[wordnum];
368368

@@ -474,7 +474,7 @@ tbm_intersect_page(TIDBitmap *a, PagetableEntry *apage, const TIDBitmap *b)
474474
/* Scan each bit in chunk, try to clear */
475475
bool candelete = true;
476476

477-
for (wordnum = 0; wordnum < WORDS_PER_PAGE; wordnum++)
477+
for (wordnum = 0; wordnum < WORDS_PER_CHUNK; wordnum++)
478478
{
479479
bitmapword w = apage->words[wordnum];
480480

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy