string, in case the format string contains printf conversions
assembled from escape sequences.
A better approach might be to adjust the unescape logic to avoid
generating printf conversions (e.g. convert \x25 to %% instead of %)
but that's somewhat problematic and it's not really worth taking the
trouble.
Running valid_format() only after unescaping would also be somewhat
tidier but makes printing the invalid format string problematic,
because the unescape logic runs in place.
None of these cases are really worth worrying about in detail, but now
at least they don't result in SIGSEGV.
Related to PR 43355.