From f2eaea3be2ebf87e2837b728e5a0c67eedf296f5 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 3 May 2021 23:28:07 +0200 Subject: lib: gracefully handle truncated format strings in uc_printf_common() Signed-off-by: Jo-Philipp Wich --- tests/custom/03_bugs/19_truncated_format_string | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/custom/03_bugs/19_truncated_format_string (limited to 'tests/custom/03_bugs') diff --git a/tests/custom/03_bugs/19_truncated_format_string b/tests/custom/03_bugs/19_truncated_format_string new file mode 100644 index 0000000..8ddd0a3 --- /dev/null +++ b/tests/custom/03_bugs/19_truncated_format_string @@ -0,0 +1,14 @@ +When processing a truncated format string, uc_printf_common() - which is +used by `sprintf()` and `printf()` in ucode - appended trailing garbage +to the resulting string. + +-- Expect stdout -- +[ 37, null ] +-- End -- + +-- Testcase -- +{% + let s = sprintf("%"); + print(ord(s, 0, 1), "\n"); +%} +-- End -- -- cgit v1.2.3