Fix crash when using printf format specifiers in traceEvent (#3874)