• Paul Eggert's avatar
    Narrow pointer bounds when appropriate · 4295050e
    Paul Eggert authored
    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.
    4295050e
gmalloc.c 57.6 KB