The buffer is guaranteed to be zero-terminated so we can just
circumvent the check. Found by afl-fuzz.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233496
91177308-0d34-0410-b5e6-
96231b3b80d8
}
if (buffer[end] == ' ') {
+ assert((end + 1 != buffer.size() || buffer.data()[end + 1] == 0) &&
+ "buffer not zero-terminated!");
if (canRemoveWhitespace(/*left=*/buffer[begin-1],
/*beforeWSpace=*/buffer[end-1],
- /*right=*/buffer[end+1],
+ /*right=*/buffer.data()[end + 1], // zero-terminated
LangOpts))
++len;
return;
--- /dev/null
+// RUN: not %clang_cc1 %s -fsyntax-only -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s
+// vim: set binary noeol:
+
+// This file intentionally ends without a \n on the last line. Make sure your
+// editor doesn't add one. The trailing space is also intentional.
+
+// CHECK: :9:8: warning: duplicate 'extern' declaration specifier
+// CHECK: fix-it:"{{.*}}":{9:8-9:15}:""
+extern extern
\ No newline at end of file