From: Andrea Corallo Date: Sun, 29 Sep 2019 12:32:02 +0000 (+0200) Subject: don't crash when trying to format a very long string X-Git-Tag: emacs-28.0.90~2727^2~1104 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8f1670b40fc9a779303207710a913b769170e82a;p=emacs.git don't crash when trying to format a very long string --- diff --git a/src/comp.c b/src/comp.c index 48ddba7eb27..f55aa8191e3 100644 --- a/src/comp.c +++ b/src/comp.c @@ -205,7 +205,11 @@ format_string (const char *format, ...) va_start (va, format); int res = vsnprintf (scratch_area, sizeof (scratch_area), format, va); if (res >= sizeof (scratch_area)) - error ("Truncating string"); + { + scratch_area[sizeof (scratch_area) - 4] = '.'; + scratch_area[sizeof (scratch_area) - 3] = '.'; + scratch_area[sizeof (scratch_area) - 2] = '.'; + } va_end (va); return scratch_area; } @@ -302,7 +306,7 @@ register_emitter (Lisp_Object key, void *func) Fputhash (key, value, comp.emitter_dispatcher); } -INLINE static void +static void emit_comment (const char *str) { if (COMP_DEBUG)