]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix bogus MaxAllocSize check in logtape.c.
authorJeff Davis <jdavis@postgresql.org>
Fri, 4 Sep 2020 19:01:58 +0000 (12:01 -0700)
committerJeff Davis <jdavis@postgresql.org>
Fri, 4 Sep 2020 19:11:22 +0000 (12:11 -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 5517e59c50fd8e38ba72c8d416e65373c6e1b3bd..cdd8a836deab33bab6e7d5a9bb057e09698e91d1 100644 (file)
@@ -489,7 +489,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;