[clang] 689fa1d - Fix Unintialised char *CommentLexer resulting in potential UB. (#210067)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 09:00:13 PDT 2026


Author: Hardik Kumar
Date: 2026-07-16T12:00:08-04:00
New Revision: 689fa1d6d74a465130ad0b1705813e14d1cd5b1a

URL: https://github.com/llvm/llvm-project/commit/689fa1d6d74a465130ad0b1705813e14d1cd5b1a
DIFF: https://github.com/llvm/llvm-project/commit/689fa1d6d74a465130ad0b1705813e14d1cd5b1a.diff

LOG: Fix Unintialised char *CommentLexer resulting in potential UB. (#210067)

The patch intialised the  pointer to a .
Previously the pointer would have some garbage value which might have
resulted in UB.

closes #210034

Added: 
    

Modified: 
    clang/include/clang/AST/CommentLexer.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/CommentLexer.h b/clang/include/clang/AST/CommentLexer.h
index 194a31cb7b934..ddeb92dc4e0e8 100644
--- a/clang/include/clang/AST/CommentLexer.h
+++ b/clang/include/clang/AST/CommentLexer.h
@@ -240,7 +240,7 @@ class Lexer {
 
   /// One past end pointer for the current comment.  For BCPL comments points
   /// to newline or BufferEnd, for C comments points to star in '*/'.
-  const char *CommentEnd;
+  const char *CommentEnd = nullptr;
 
   SourceLocation FileLoc;
 


        


More information about the cfe-commits mailing list