From: Paul Eggert Date: Fri, 19 Jul 2013 17:54:26 +0000 (-0700) Subject: * alloc.c (staticpro): Avoid buffer overrun on repeated calls. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1759^2~2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4195afc389bb0e5ed5aa749e7606a710e07a72d1;p=emacs.git * alloc.c (staticpro): Avoid buffer overrun on repeated calls. (NSTATICS): Now a constant; doesn't need to be a macro. --- diff --git a/src/ChangeLog b/src/ChangeLog index 975bcaaba0e..73e24bcf829 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-07-19 Paul Eggert + + * alloc.c (staticpro): Avoid buffer overrun on repeated calls. + (NSTATICS): Now a constant; doesn't need to be a macro. + 2013-07-19 Richard Stallman * 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; /* Addresses of staticpro'd variables. Initialize it to a nonzero value; otherwise some compilers put it into BSS. */ -#define NSTATICS 0x800 +enum { NSTATICS = 2048 }; static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag}; /* Index of next unused slot in staticvec. */ @@ -5136,9 +5136,9 @@ Does not copy symbols. Copies strings without text properties. */) void staticpro (Lisp_Object *varaddress) { - staticvec[staticidx++] = varaddress; if (staticidx >= NSTATICS) fatal ("NSTATICS too small; try increasing and recompiling Emacs."); + staticvec[staticidx++] = varaddress; }