[clang-format][PR41964] Fix crash with SIGFPE when TabWidth is set to 0 and line...
authorPaul Hoad <mydeveloperday@gmail.com>
Wed, 18 Sep 2019 18:57:09 +0000 (18:57 +0000)
committerPaul Hoad <mydeveloperday@gmail.com>
Wed, 18 Sep 2019 18:57:09 +0000 (18:57 +0000)
commit79983be5a027c0ff8a7ef7a8f67481ce61efc523
tree3e5eeaedc9cdc0363ed935223dcf74da669aedad
parentba4cad9039660d322937f7f44bcb30b4849c3d58
[clang-format][PR41964] Fix crash with SIGFPE when TabWidth is set to 0 and line starts with tab

Summary:
clang-format 8.0 crashes with SIGFPE (floating point exception) when formatting following file:
app.cpp:
void a() {
//line starts with '\t'
}

$ clang-format -style='{TabWidth: 0}' app.cpp

Reviewers: owenpan, klimek, russellmcc, timwoj

Reviewed By: klimek

Subscribers: cfe-commits

Tags: #clang-tools-extra, #clang

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

llvm-svn: 372246
clang/lib/Format/Encoding.h
clang/lib/Format/FormatTokenLexer.cpp
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp