Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-22698

clang-format can produce an indentation of the uassert macro that fools the zero-code checker

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.2
    • Component/s: Build
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.2
    • Sprint:
      Integration 10 (02/22/16)

      Description

      The zero code checker doesn't catch this code. The code can also be a duplicate of another code, it still doesn't catch it.

      Example file:

      #include "mongo/util/assert_util.h"                                                                                                                                                                                
                                                                                                                                                                                                                         
      namespace mongo {                                                                                                                                                                                                  
                                                                                                                                                                                                                         
      void test() {                                                                                                                                                                                                      
          bool x = true;                                                                                                                                                                                                 
          if (x) {                                                                                                                                                                                                       
              uassert(                                                                                                                                                                                                   
                  0,                                                                                                                                                                                                 
                  "String that is exactly the right amount of characters to produce this indentation.",                                                                                                                  
                  x);                                                                                                                                                                                                    
          }                                                                                                                                                                                                              
      }                                                                                                                                                                                                                  
      }             
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: