This approach ensures we don't use an SSDATA pointer after GC, and
that no Lisp callback code can modify the format string while we're
working on it.
* src/editfns.c (styled_format): Operate on a copy of the format
string rather than the original. Ensure final NUL byte is copied.
(cherry picked from commit
14ebe4d5dbd4e6637de227c8561aab22cf4b632c)
} *info;
CHECK_STRING (args[0]);
- char *format_start = SSDATA (args[0]);
bool multibyte_format = STRING_MULTIBYTE (args[0]);
ptrdiff_t formatlen = SBYTES (args[0]);
+ char *format_start = SAFE_ALLOCA (formatlen + 1);
+ memcpy (format_start, SSDATA (args[0]), formatlen + 1);
bool fmt_props = !!string_intervals (args[0]);
/* Upper bound on number of format specs. Each uses at least 2 chars. */