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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Done
    • None
    • 3.3.2
    • Build
    • Fully Compatible
    • ALL
    • v3.2
    • 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

              adam.midvidy Adam Midvidy
              adam.midvidy Adam Midvidy
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: