aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-07-19 10:54:26 -0700
committerPaul Eggert2013-07-19 10:54:26 -0700
commit4195afc389bb0e5ed5aa749e7606a710e07a72d1 (patch)
tree60dfc46ed7b1cc06d36faaa291ec0ae3fb020843 /src
parenta1aeeffedd3b05a33bdd73737651debbda00cf5f (diff)
downloademacs-4195afc389bb0e5ed5aa749e7606a710e07a72d1.tar.gz
emacs-4195afc389bb0e5ed5aa749e7606a710e07a72d1.zip
* alloc.c (staticpro): Avoid buffer overrun on repeated calls.
(NSTATICS): Now a constant; doesn't need to be a macro.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/alloc.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 975bcaaba0e..73e24bcf829 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12013-07-19 Paul Eggert <eggert@cs.ucla.edu>
2
3 * alloc.c (staticpro): Avoid buffer overrun on repeated calls.
4 (NSTATICS): Now a constant; doesn't need to be a macro.
5
12013-07-19 Richard Stallman <rms@gnu.org> 62013-07-19 Richard Stallman <rms@gnu.org>
2 7
3 * coding.c (decode_coding_utf_8): Add simple loop for fast 8 * coding.c (decode_coding_utf_8): Add simple loop for fast
diff --git a/src/alloc.c b/src/alloc.c
index 11245741bd5..4c924f72384 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -341,7 +341,7 @@ struct gcpro *gcprolist;
341/* Addresses of staticpro'd variables. Initialize it to a nonzero 341/* Addresses of staticpro'd variables. Initialize it to a nonzero
342 value; otherwise some compilers put it into BSS. */ 342 value; otherwise some compilers put it into BSS. */
343 343
344#define NSTATICS 0x800 344enum { NSTATICS = 2048 };
345static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag}; 345static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag};
346 346
347/* Index of next unused slot in staticvec. */ 347/* Index of next unused slot in staticvec. */
@@ -5136,9 +5136,9 @@ Does not copy symbols. Copies strings without text properties. */)
5136void 5136void
5137staticpro (Lisp_Object *varaddress) 5137staticpro (Lisp_Object *varaddress)
5138{ 5138{
5139 staticvec[staticidx++] = varaddress;
5140 if (staticidx >= NSTATICS) 5139 if (staticidx >= NSTATICS)
5141 fatal ("NSTATICS too small; try increasing and recompiling Emacs."); 5140 fatal ("NSTATICS too small; try increasing and recompiling Emacs.");
5141 staticvec[staticidx++] = varaddress;
5142} 5142}
5143 5143
5144 5144