Skip to content

Commit 9afcafb

Browse files
committed
Cast to uint64 to avoid int32 overflow when setting ptrack_map_size
1 parent fd6cee0 commit 9afcafb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

engine.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,14 +515,14 @@ assign_ptrack_map_size(int newval, void *extra)
515515
if (newval != 0 && !XLogIsNeeded())
516516
ereport(ERROR,
517517
(errmsg("assign_ptrack_map_size: cannot use ptrack if wal_level is minimal"),
518-
errdetail("Set wal_level to \"replica\" or higher, or turn off ptrack with \"ptrack_map_size=0\"")));
518+
errdetail("Set wal_level to \"replica\" or higher, or turn off ptrack with \"ptrack.map_size=0\"")));
519519

520520
if (DataDir != NULL &&
521521
!IsBootstrapProcessingMode() &&
522522
!InitializingParallelWorker)
523523
{
524-
/* Always assign ptrack_map_size */
525-
ptrack_map_size = newval * 1024 * 1024;
524+
/* Cast to uint64 in order to avoid int32 overflow */
525+
ptrack_map_size = (uint64) 1024 * 1024 * newval;
526526

527527
elog(DEBUG1, "assign_ptrack_map_size: ptrack_map_size set to " UINT64_FORMAT,
528528
ptrack_map_size);

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