File tree Expand file tree Collapse file tree 4 files changed +4
-14
lines changed Expand file tree Collapse file tree 4 files changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -309,10 +309,9 @@ static void lengthExprHandle(const Expr *LengthExpr,
309309  //  Try to obtain an 'IntegerLiteral' and adjust it.
310310  if  (!IsMacroDefinition) {
311311    if  (const  auto  *LengthIL = dyn_cast<IntegerLiteral>(LengthExpr)) {
312-       size_t  NewLength = LengthIL->getValue ().getZExtValue () +
313-                          (LengthHandle == LengthHandleKind::Increase
314-                               ? (isInjectUL (Result) ? 1UL  : 1 )
315-                               : -1 );
312+       uint64_t  NewLength =
313+           LengthIL->getValue ().getZExtValue () +
314+           (LengthHandle == LengthHandleKind::Increase ? 1  : -1 );
316315
317316      const  auto  NewLengthFix = FixItHint::CreateReplacement (
318317          LengthIL->getSourceRange (),
Original file line number Diff line number Diff line change @@ -276,6 +276,7 @@ Changes in existing checks
276276
277277- Improved :doc: `bugprone-not-null-terminated-result 
278278  <clang-tidy/checks/bugprone/not-null-terminated-result>` check by fixing
279+   bogus fix-its for ``strncmp `` and ``wcsncmp `` on Windows and
279280  a crash caused by certain value-dependent expressions.
280281
281282- Improved :doc: `bugprone-reserved-identifier 
Original file line number Diff line number Diff line change 11// RUN: %check_clang_tidy %s bugprone-not-null-terminated-result %t -- \ 
22// RUN: -- -I %S/Inputs/not-null-terminated-result 
33
4- // FIXME: Something wrong with the APInt un/signed conversion on Windows: 
5- // in 'strncmp(str6, "string", 7);' it tries to inject '4294967302' as length. 
6- 
7- // UNSUPPORTED: system-windows 
8- 
94#include  "not-null-terminated-result-c.h" 
105
116#define  __STDC_LIB_EXT1__  1
Original file line number Diff line number Diff line change 11//  RUN: %check_clang_tidy -std=c++11-or-later %s bugprone-not-null-terminated-result %t -- \
22// RUN: -- -I %S/Inputs/not-null-terminated-result 
33
4- //  FIXME: Something wrong with the APInt un/signed conversion on Windows:
5- //  in 'wcsncmp(wcs6, L"string", 7);' it tries to inject '4294967302' as length.
6- 
7- //  UNSUPPORTED: system-windows
8- 
94#include  " not-null-terminated-result-cxx.h" 
105
116#define  __STDC_LIB_EXT1__  1 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments