]> git.eshelyaron.com Git - emacs.git/commitdiff
don't crash when trying to format a very long string
authorAndrea Corallo <akrl@sdf.org>
Sun, 29 Sep 2019 12:32:02 +0000 (14:32 +0200)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:37:54 +0000 (11:37 +0100)
src/comp.c

index 48ddba7eb270f151cbaeb01945326a1b2197e8fb..f55aa8191e3a48372c6b81c27f7f46480d387293 100644 (file)
@@ -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)