[PATCH] D67670: [clang-format][PR41964] Fix crash with SIGFPE when TabWidth is set to 0 and line starts with tab

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 17 11:27:54 PDT 2019


klimek added inline comments.


================
Comment at: clang/lib/Format/FormatTokenLexer.cpp:660
       case '\t':
-        Column += Style.TabWidth - Column % Style.TabWidth;
+        Column += Style.TabWidth - (Column ? Column % Style.TabWidth : 0);
         break;
----------------
Shouldn't that be (Style.TabWidth ? Column % Style.TabWidth)?
Otherwise can't that still crash when Column != 0 and TabWidth is 0?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67670/new/

https://reviews.llvm.org/D67670





More information about the cfe-commits mailing list