From 582843ee37fb2de62321085dd3c2f4bfbdbad12e Mon Sep 17 00:00:00 2001 From: msizanoen1 Date: Wed, 1 Mar 2023 21:48:08 +0700 Subject: [PATCH] test-escape: Add tests for escaping bogus UTF-8 sequences --- src/test/test-escape.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/test-escape.c b/src/test/test-escape.c index b1ab5bab18..f3dd579e56 100644 --- a/src/test/test-escape.c +++ b/src/test/test-escape.c @@ -196,6 +196,10 @@ TEST(shell_maybe_quote) { test_shell_maybe_quote_one("głąb\002\003rząd", 0, "\"głąb\\002\\003rząd\""); test_shell_maybe_quote_one("głąb\002\003rząd", SHELL_ESCAPE_POSIX, "$'głąb\\002\\003rząd'"); + + /* Bogus UTF-8 strings */ + test_shell_maybe_quote_one("\250\350", 0, "\"\\250\\350\""); + test_shell_maybe_quote_one("\250\350", SHELL_ESCAPE_POSIX, "$'\\250\\350'"); } static void test_quote_command_line_one(char **argv, const char *expected) { -- 2.25.1