emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113466: * alloc.c (staticpro): Avoid buffer overrun


From: Paul Eggert
Subject: [Emacs-diffs] trunk r113466: * alloc.c (staticpro): Avoid buffer overrun on repeated calls.
Date: Fri, 19 Jul 2013 17:54:30 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113466
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Fri 2013-07-19 10:54:26 -0700
message:
  * alloc.c (staticpro): Avoid buffer overrun on repeated calls.
  
  (NSTATICS): Now a constant; doesn't need to be a macro.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/alloc.c                    alloc.c-20091113204419-o5vbwnq5f7feedwu-252
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-07-19 16:15:51 +0000
+++ b/src/ChangeLog     2013-07-19 17:54:26 +0000
@@ -1,3 +1,8 @@
+2013-07-19  Paul Eggert  <address@hidden>
+
+       * 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  <address@hidden>
 
        * coding.c (decode_coding_utf_8): Add simple loop for fast

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2013-07-19 01:24:35 +0000
+++ b/src/alloc.c       2013-07-19 17:54:26 +0000
@@ -341,7 +341,7 @@
 /* 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 @@
 void
 staticpro (Lisp_Object *varaddress)
 {
-  staticvec[staticidx++] = varaddress;
   if (staticidx >= NSTATICS)
     fatal ("NSTATICS too small; try increasing and recompiling Emacs.");
+  staticvec[staticidx++] = varaddress;
 }
 
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]