Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
6c2935e9
Commit
6c2935e9
authored
Aug 15, 1997
by
Richard M. Stallman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(main): Update re_max_failures so regex.c won't overflow
the stack, except when dumping.
parent
74700529
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
src/emacs.c
src/emacs.c
+15
-4
No files found.
src/emacs.c
View file @
6c2935e9
...
...
@@ -579,12 +579,19 @@ main (argc, argv, envp)
#endif
/* VMS */
#if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK)
/* Extend the stack space available. */
if
(
!
getrlimit
(
RLIMIT_STACK
,
&
rlim
))
/* Extend the stack space available.
Don't do that if dumping, since some systems (e.g. DJGPP)
might define a smaller stack limit at that time. */
if
(
1
#ifndef CANNOT_DUMP
&&
(
!
noninteractive
||
initialized
)
#endif
&&
!
getrlimit
(
RLIMIT_STACK
,
&
rlim
))
{
long
newlim
;
extern
int
re_max_failures
;
/* Approximate the amount regex.c needs, plus some more. */
newlim
=
80000
0
*
sizeof
(
char
*
);
newlim
=
re_max_failures
*
2
*
2
0
*
sizeof
(
char
*
);
#ifdef __NetBSD__
/* NetBSD (at least NetBSD 1.2G and former) has a bug in its
stack allocation routine for new process that the allocation
...
...
@@ -593,7 +600,11 @@ main (argc, argv, envp)
newlim
=
(
newlim
+
getpagesize
()
-
1
)
/
getpagesize
()
*
getpagesize
();
#endif
if
(
newlim
>
rlim
.
rlim_max
)
newlim
=
rlim
.
rlim_max
;
{
newlim
=
rlim
.
rlim_max
;
/* Don't let regex.c overflow the stack. */
re_max_failures
=
newlim
/
(
2
*
20
*
sizeof
(
char
*
));
}
if
(
rlim
.
rlim_cur
<
newlim
)
rlim
.
rlim_cur
=
newlim
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment