summaryrefslogtreecommitdiffstats
path: root/clang/test/Lexer
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-05-04 22:30:29 +0000
committerKostya Serebryany <kcc@google.com>2015-05-04 22:30:29 +0000
commit6c2479bee4cb3dad62e11b8cf774f95204bb518d (patch)
tree77a268bd7789a1165388cbc05eb169161ed67f59 /clang/test/Lexer
parenta68970dfd58dab5443707efc13ed682d6fbd076c (diff)
downloadbcm5719-llvm-6c2479bee4cb3dad62e11b8cf774f95204bb518d.tar.gz
bcm5719-llvm-6c2479bee4cb3dad62e11b8cf774f95204bb518d.zip
Fix buffer overflow in Lexer
Summary: Fix PR22407, where the Lexer overflows the buffer when parsing #include<\ (end of file after slash) Test Plan: Added a test that will trigger in asan build. This case is also covered by the clang-fuzzer bot. Reviewers: rnk Reviewed By: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9489 llvm-svn: 236466
Diffstat (limited to 'clang/test/Lexer')
-rw-r--r--clang/test/Lexer/eof-include.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Lexer/eof-include.c b/clang/test/Lexer/eof-include.c
new file mode 100644
index 00000000000..6e537887188
--- /dev/null
+++ b/clang/test/Lexer/eof-include.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -verify
+// vim: set binary noeol:
+
+// This file intentionally ends without a \n on the last line. Make sure your
+// editor doesn't add one.
+
+// expected-error@+1{{expected "FILENAME" or <FILENAME>}}
+#include <\ \ No newline at end of file
OpenPOWER on IntegriCloud