From 3f1d93bb4e377a320b4e3edb6c0a959e8f997bb2 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 15 Jun 2021 23:24:23 +0200 Subject: util.format: Escape ASCII control characters in output This should offer some protection against doing evil things to terminals. Doesn't protect against pure broken UTF-8 garbage however. See #734 --- spec/util_format_spec.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spec') diff --git a/spec/util_format_spec.lua b/spec/util_format_spec.lua index 50509630..a8bcfd97 100644 --- a/spec/util_format_spec.lua +++ b/spec/util_format_spec.lua @@ -15,5 +15,10 @@ describe("util.format", function() assert.equal("[1.5]", format("%d", 1.5)); assert.equal("[7.3786976294838e+19]", format("%d", 73786976294838206464)); end); + + it("escapes ascii control stuff", function () + assert.equal("␁", format("%s", "\1")); + end); + end); end); -- cgit v1.2.3