[Lexer] Don't read out of bounds if a conflict marker is at the end of a file
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 1 Apr 2016 09:58:45 +0000 (09:58 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 1 Apr 2016 09:58:45 +0000 (09:58 +0000)
commite550bbdf9d7c4e5eb0b23a50203039808c7a2be4
tree4961d0f4e66d1cea1d4f4e8f9c6950d49091841c
parenta5d09f64a11570fb39a0db176ee9d226aa4ae094
[Lexer] Don't read out of bounds if a conflict marker is at the end of a file

This can happen as we look for '<<<<' while scanning tokens but then expect
'<<<<\n' to tell apart perforce from diff3 conflict markers. Just harden
the pointer arithmetic.

Found by libfuzzer + asan!

llvm-svn: 265125
clang/lib/Lex/Lexer.cpp
clang/test/Lexer/eof-conflict-marker.c [new file with mode: 0644]