Fix bogus MaxAllocSize check in logtape.c.
authorJeff Davis <[email protected]>
Fri, 4 Sep 2020 19:01:58 +0000 (12:01 -0700)
committerJeff Davis <[email protected]>
Fri, 4 Sep 2020 19:09:52 +0000 (12:09 -0700)
Reported-by: Peter Geoghegan
Discussion: https://postgr.es/m/CAH2-Wz=NZPZc3-fkdmvu=w2itx0PiB-G6QpxHXZOjuvFAzPdZw@mail.gmail.com
Backpatch-through: 13

src/backend/utils/sort/logtape.c

index 788815cdab6ca9f37a8e9ef3bbdb6d72c5d88adc..bbb01f6d3373972262b6083c0c955eae33946d8b 100644 (file)
@@ -491,7 +491,7 @@ ltsReleaseBlock(LogicalTapeSet *lts, long blocknum)
         * If the freelist becomes very large, just return and leak this free
         * block.
         */
-       if (lts->freeBlocksLen * 2 > MaxAllocSize)
+       if (lts->freeBlocksLen * 2 * sizeof(long) > MaxAllocSize)
            return;
 
        lts->freeBlocksLen *= 2;