From 11ecf666465c74fc27ca2e5213753ac1cd53b915 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 (cherry picked from commit 582843ee37fb2de62321085dd3c2f4bfbdbad12e) (cherry picked from commit c4e7cf2bd734b480c38b16c227a2b4f1928df270) (cherry picked from commit dec5e2e7b5ae829b8542810c5d44daed3442cb28) --- 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 ce46fbe760..221044f2b7 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) {