summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2018-05-22 11:44:03 +0000
committerKrasimir Georgiev <krasimir@google.com>2018-05-22 11:44:03 +0000
commit067ec70d4fcbfc6bbb437110d94bf7e301717cd8 (patch)
tree4e33526c8f6667969f86ec877ba2e42a47db3fc8
parentf528bcc32a1cb383d2ab4c174fdcda184d2ba3ff (diff)
downloadbcm5719-llvm-067ec70d4fcbfc6bbb437110d94bf7e301717cd8.tar.gz
bcm5719-llvm-067ec70d4fcbfc6bbb437110d94bf7e301717cd8.zip
[clang-format] Add a test case for crash
llvm-svn: 332974
-rw-r--r--clang/unittests/Format/FormatTest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 3f9e8056314..624b086a216 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -6628,6 +6628,18 @@ TEST_F(FormatTest, IncorrectCodeUnbalancedBraces) {
verifyNoCrash("(/**/[:!] ?[).");
}
+TEST_F(FormatTest, IncorrectUnbalancedBracesInMacrosWithUnicode) {
+ // Found by oss-fuzz:
+ // https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8212
+ FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp);
+ Style.ColumnLimit = 60;
+ verifyNoCrash(
+ "\x23\x47\xff\x20\x28\xff\x3c\xff\x3f\xff\x20\x2f\x7b\x7a\xff\x20"
+ "\xff\xff\xff\xca\xb5\xff\xff\xff\xff\x3a\x7b\x7d\xff\x20\xff\x20"
+ "\xff\x74\xff\x20\x7d\x7d\xff\x7b\x3a\xff\x20\x71\xff\x20\xff\x0a",
+ Style);
+}
+
TEST_F(FormatTest, IncorrectCodeDoNoWhile) {
verifyFormat("do {\n}");
verifyFormat("do {\n}\n"
OpenPOWER on IntegriCloud