From 4195afc389bb0e5ed5aa749e7606a710e07a72d1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 19 Jul 2013 10:54:26 -0700 Subject: [PATCH] * alloc.c (staticpro): Avoid buffer overrun on repeated calls. (NSTATICS): Now a constant; doesn't need to be a macro. --- src/ChangeLog | 5 +++++ src/alloc.c | 4 ++-- 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 @@ +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; } -- 2.11.4.GIT