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
Paths
| Differential D67670
[clang-format][PR41964] Fix crash with SIGFPE when TabWidth is set to 0 and line starts with tab ClosedPublic Authored by MyDeveloperDay on Sep 17 2019, 10:37 AM.
Details
Summary clang-format 8.0 crashes with SIGFPE (floating point exception) when formatting following file: $ clang-format -style='{TabWidth: 0}' app.cpp
Diff Detail Event Timeline
MyDeveloperDay added inline comments.
Comment Actions I should have known it was more involved. v % 0 and v / 0 are both undefined behavior This revision is now accepted and ready to land.Sep 18 2019, 12:45 AM Closed by commit rL372246: [clang-format][PR41964] Fix crash with SIGFPE when TabWidth is set to 0 and… (authored by MyDeveloperDay). · Explain WhySep 18 2019, 11:58 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 220571 clang/lib/Format/FormatTokenLexer.cpp
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp
|
Shouldn't that be (Style.TabWidth ? Column % Style.TabWidth)?
Otherwise can't that still crash when Column != 0 and TabWidth is 0?