llvm-project/clang/lib/Lex
Volodymyr Sapsai 579f0b307c [Lex] Fix handling numerical literals ending with ' and signed exponent.
For input `0'e+1` lexer tokenized as numeric constant only `0'e`. Later
NumericLiteralParser skipped 0 and ' as digits and parsed `e+1` as valid
exponent going past the end of the token. Because it didn't mark numeric
literal as having an error, it continued parsing and tried to expandUCNs
with StringRef of length -2.

The fix is not to parse exponent when we reached the end of token.

Discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4588

rdar://problem/36076719

Reviewers: rsmith, t.p.northover

Reviewed By: rsmith

Subscribers: cfe-commits, jkorous-apple

Differential Revision: https://reviews.llvm.org/D41834

llvm-svn: 324419
2018-02-06 22:39:25 +00:00
..
CMakeLists.txt
HeaderMap.cpp Use StringRef for MemoryBuffer identifier API (NFC) 2016-10-01 16:38:28 +00:00
HeaderSearch.cpp [Lexer] Support adding working directory to relative search dir for #include shortening in HeaderSearch. 2018-01-29 13:21:23 +00:00
Lexer.cpp [Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral. 2018-01-12 18:54:35 +00:00
LiteralSupport.cpp [Lex] Fix handling numerical literals ending with ' and signed exponent. 2018-02-06 22:39:25 +00:00
MacroArgs.cpp [c++2a] Implement P0306 __VA_OPT__ (Comma omission and comma deletion) 2017-10-15 01:26:26 +00:00
MacroInfo.cpp [Lex] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-12-04 23:16:21 +00:00
ModuleMap.cpp Track shadow modules with a generation counter. 2018-01-05 22:13:56 +00:00
PPCaching.cpp [Lex] Fix crash on code completion in comment in included file. 2018-01-19 23:41:47 +00:00
PPCallbacks.cpp
PPConditionalDirectiveRecord.cpp Switch PPCallbacks to take the new MacroDefinition instead of MacroDirective*, in order to preserve full information on module macro expansion. 2015-05-04 03:15:40 +00:00
PPDirectives.cpp [PCH] Serialize skipped preprocessor ranges 2018-01-15 19:14:16 +00:00
PPExpressions.cpp Keep the IdentifierInfo in the Token for alternative operator keyword 2017-07-14 09:23:40 +00:00
PPLexerChange.cpp [Lex] Fix crash on code completion in comment in included file. 2018-01-19 23:41:47 +00:00
PPMacroExpansion.cpp __is_target_environment: Check the environment after parsing it 2017-12-15 20:07:53 +00:00
PTHLexer.cpp [Lex] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-12-06 23:18:41 +00:00
Pragma.cpp Always allow "#pragma region". 2018-01-27 00:25:29 +00:00
PreprocessingRecord.cpp [PCH] Serialize skipped preprocessor ranges 2018-01-15 19:14:16 +00:00
Preprocessor.cpp [CodeComplete] Fix completion in the middle of idents in macro calls 2018-01-22 17:18:28 +00:00
PreprocessorLexer.cpp [Lex] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-12-04 23:16:21 +00:00
ScratchBuffer.cpp [Lex] Use WritableMemoryBuffer in ScratchBuffer.cpp 2018-01-11 10:43:45 +00:00
TokenConcatenation.cpp Now that C++17 is official (https://www.iso.org/standard/68564.html), start changing the C++1z terminology over to C++17. NFC intended, these are all mechanical changes. 2017-12-04 20:27:34 +00:00
TokenLexer.cpp [Lex] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-12-08 22:39:26 +00:00
UnicodeCharSets.h