+2013-01-19 Eli Zaretskii <eliz@gnu.org>
+
+ * editfns.c (get_pos_property): Use SAFE_ALLOCA_LISP, to avoid
+ segfault when there are lots of overlays.
+
+ * buffer.c (sort_overlays): Use SAFE_NALLOCA, to avoid segfault
+ when there are lots of overlays. See
+ http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00421.html
+ for the details and a way to reproduce.
+
2013-01-19 Paul Eggert <eggert@cs.ucla.edu>
* fileio.c: Use O_APPEND to append.
sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t noverlays, struct window *w)
{
ptrdiff_t i, j;
- struct sortvec *sortvec = alloca (noverlays * sizeof *sortvec);
+ USE_SAFE_ALLOCA;
+ struct sortvec *sortvec;
+
+ SAFE_NALLOCA (sortvec, 1, noverlays);
/* Put the valid and relevant overlays into sortvec. */
for (i = 0; i < noverlays; i++)
overlay_vec[i] = sortvec[i].overlay;
+
+ SAFE_FREE ();
return (noverlays);
}
\f
ptrdiff_t noverlays;
Lisp_Object *overlay_vec, tem;
struct buffer *obuf = current_buffer;
+ USE_SAFE_ALLOCA;
set_buffer_temp (XBUFFER (object));
make enough space for all, and try again. */
if (noverlays > 40)
{
- overlay_vec = alloca (noverlays * sizeof *overlay_vec);
+ SAFE_ALLOCA_LISP (overlay_vec, noverlays);
noverlays = overlays_around (posn, overlay_vec, noverlays);
}
noverlays = sort_overlays (overlay_vec, noverlays, NULL);
; /* The overlay will not cover a char inserted at point. */
else
{
+ SAFE_FREE ();
return tem;
}
}
}
+ SAFE_FREE ();
{ /* Now check the text properties. */
int stickiness = text_property_stickiness (prop, position, object);