diff options
| author | Paul Eggert | 2018-10-03 15:55:43 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-10-03 15:57:26 -0700 |
| commit | 945a7622326f7d93dd318f01d54f6bf23e0021cf (patch) | |
| tree | c2226b26699d51b2597ae0be2955db02571b9782 /src | |
| parent | 5cbce95796a2a8b8857fb9e289a9fd9a1158677b (diff) | |
| download | emacs-945a7622326f7d93dd318f01d54f6bf23e0021cf.tar.gz emacs-945a7622326f7d93dd318f01d54f6bf23e0021cf.zip | |
Fix emacs_re_safe_alloca calculation
Problem and draft fix noted by Eli Zaretskii in:
https://lists.gnu.org/r/emacs-devel/2018-10/msg00022.html
* src/emacs.c (main): Fix arithmetic used in calculation
of emacs_re_safe_alloca.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/emacs.c b/src/emacs.c index b1c96d18285..ddaaf3fed51 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -888,11 +888,11 @@ main (int argc, char **argv) | |||
| 888 | lim = newlim; | 888 | lim = newlim; |
| 889 | } | 889 | } |
| 890 | } | 890 | } |
| 891 | /* If the stack is big enough, let regex-emacs.c more of it before | 891 | /* If the stack is big enough, let regex-emacs.c use more of it |
| 892 | falling back to heap allocation. */ | 892 | before falling back to heap allocation. */ |
| 893 | emacs_re_safe_alloca = max | 893 | ptrdiff_t max_failures |
| 894 | (min (lim - extra, SIZE_MAX) * (min_ratio / ratio), | 894 | = min (lim - extra, min (PTRDIFF_MAX, SIZE_MAX)) / ratio; |
| 895 | MAX_ALLOCA); | 895 | emacs_re_safe_alloca = max (max_failures * min_ratio, MAX_ALLOCA); |
| 896 | } | 896 | } |
| 897 | #endif /* HAVE_SETRLIMIT and RLIMIT_STACK and not CYGWIN */ | 897 | #endif /* HAVE_SETRLIMIT and RLIMIT_STACK and not CYGWIN */ |
| 898 | 898 | ||