Commit cfab4abe authored by gershomb's avatar gershomb Committed by gershomb

cap max stack size at 32 bit limit (#17019)

parent e56251f6
Pipeline #9838 failed with stages
in 669 minutes and 44 seconds
......@@ -134,6 +134,9 @@ void initRtsFlagsDefaults(void)
// if getPhysicalMemorySize fails just move along with an 8MB limit
if (maxStkSize == 0)
maxStkSize = 8 * 1024 * 1024;
// GcFlags.maxStkSiz is 32-bit, so we need to cap to prevent overflow (#17019)
else if (maxStkSize > UINT32_MAX * sizeof(W_))
maxStkSize = UINT32_MAX * sizeof(W_);
RtsFlags.GcFlags.statsFile = NULL;
RtsFlags.GcFlags.giveStats = NO_GC_STATS;
......@@ -1041,7 +1044,7 @@ error = true;
case 'K':
OPTION_UNSAFE;
RtsFlags.GcFlags.maxStkSize =
decodeSize(rts_argv[arg], 2, 0, HS_WORD_MAX)
decodeSize(rts_argv[arg], 2, 0, UINT32_MAX)
/ sizeof(W_);
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment