summaryrefslogtreecommitdiffhomepage
path: root/tests/custom
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-05-03 23:28:07 +0200
committerJo-Philipp Wich <jo@mein.io>2021-05-04 11:42:58 +0200
commitf2eaea3be2ebf87e2837b728e5a0c67eedf296f5 (patch)
tree18ea83874b4bd55608cc51638cfbc50f48638f0e /tests/custom
parent02629b84de23bdc5896ac4b357e2f16dfb3996ec (diff)
lib: gracefully handle truncated format strings in uc_printf_common()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests/custom')
-rw-r--r--tests/custom/03_bugs/19_truncated_format_string14
1 files changed, 14 insertions, 0 deletions
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 --