Skip to content

Commit 5d523eb

Browse files
committed
Further adjust #171 patch for odd stack limits
1 parent 02b196d commit 5d523eb

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ pcre2.h failed to compile.
1313
2. To catch similar issues to the above in future, a new small test program
1414
that includes pcre2posix.h but not pcre2.h has been added to the test suite.
1515

16+
3. When the -S option of pcre2test was used to set a stack size greater than
17+
the allowed maximum, the error message displayed the hard limit incorrectly.
18+
This was pointed out on GitHub pull request #171, but the suggested patch
19+
didn't cope with all cases. Some further modification was required.
20+
1621

1722
Version 10.41 06-December-2022
1823
------------------------------

src/pcre2test.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9002,9 +9002,13 @@ while (argc > 1 && argv[op][0] == '-' && argv[op][1] != 0)
90029002
if (rlim.rlim_cur > rlim.rlim_max)
90039003
{
90049004
fprintf(stderr,
9005-
"pcre2test: requested stack size %luMiB is greater than hard limit "
9006-
"%luMiB\n", (unsigned long int)stack_size,
9007-
(unsigned long int)(rlim.rlim_max / (1024 * 1024)));
9005+
"pcre2test: requested stack size %luMiB is greater than hard limit ",
9006+
(unsigned long int)stack_size);
9007+
if (rlim.rlim_max % (1024*1024) == 0) fprintf(stderr, "%luMiB\n",
9008+
(unsigned long int)(rlim.rlim_max/(1024 * 1024)));
9009+
else if (rlim.rlim_max % 1024 == 0) fprintf(stderr, "%luKiB\n",
9010+
(unsigned long int)(rlim.rlim_max/1024));
9011+
else fprintf(stderr, "%lu bytes\n", (unsigned long int)(rlim.rlim_max));
90089012
exit(1);
90099013
}
90109014
rc = setrlimit(RLIMIT_STACK, &rlim);

0 commit comments

Comments
 (0)