aboutsummaryrefslogtreecommitdiffstats
path: root/src/callint.c
diff options
context:
space:
mode:
authorPaul Eggert2017-12-09 13:57:38 -0800
committerPaul Eggert2017-12-12 15:17:12 -0800
commit4295050e1194af13afa26403dd3ebdff80824ae0 (patch)
tree354002f3c84f4d8341bb07c5f68529f660a9a405 /src/callint.c
parent881abfc7fb55db2d00adf352100cc58a6a86c176 (diff)
downloademacs-4295050e1194af13afa26403dd3ebdff80824ae0.tar.gz
emacs-4295050e1194af13afa26403dd3ebdff80824ae0.zip
Narrow pointer bounds when appropriate
This typically occurs in a storage manager, where the caller is expected to access only the newly-allocated object, instead of using the returned value to access unrelated parts of the heap. * src/alloc.c (allocate_string, allocate_string_data) (compact_small_strings, find_string_data_in_pure) (sweep_strings, setup_on_free_list, allocate_vectorlike (pure_alloc): * src/bytecode.c (exec_byte_code): * src/callint.c (Fcall_interactively): * src/dispnew.c (scrolling): * src/editfns.c (styled_format): * src/frame.c (xrdb_get_resource, x_get_resource_string): * src/fringe.c (Fdefine_fringe_bitmap): * src/gmalloc.c (malloc, realloc, aligned_alloc): Narrow pointer bounds when appropriate. * src/alloc.c (SDATA_OF_STRING): * src/lisp.h (make_lisp_symbol) [__CHKP__]: Widen bounds here, though. * src/bytecode.c, src/callint.c, src/dispnew.c, src/editfns.c: * src/emacs.c, src/frame.c, src/fringe.c: Include ptr-bounds.h. * src/ptr-bounds.h (ptr_bounds_clip): New function.
Diffstat (limited to 'src/callint.c')
-rw-r--r--src/callint.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/callint.c b/src/callint.c
index 5d88082e38d..df26e4abb51 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -21,6 +21,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
21#include <config.h> 21#include <config.h>
22 22
23#include "lisp.h" 23#include "lisp.h"
24#include "ptr-bounds.h"
24#include "character.h" 25#include "character.h"
25#include "buffer.h" 26#include "buffer.h"
26#include "keyboard.h" 27#include "keyboard.h"
@@ -494,6 +495,9 @@ invoke it. If KEYS is omitted or nil, the return value of
494 varies = (signed char *) (visargs + nargs); 495 varies = (signed char *) (visargs + nargs);
495 496
496 memclear (args, nargs * (2 * word_size + 1)); 497 memclear (args, nargs * (2 * word_size + 1));
498 args = ptr_bounds_clip (args, nargs * sizeof *args);
499 visargs = ptr_bounds_clip (visargs, nargs * sizeof *visargs);
500 varies = ptr_bounds_clip (varies, nargs * sizeof *varies);
497 501
498 if (!NILP (enable)) 502 if (!NILP (enable))
499 specbind (Qenable_recursive_minibuffers, Qt); 503 specbind (Qenable_recursive_minibuffers, Qt);