https://github.com/hardikxk updated 
https://github.com/llvm/llvm-project/pull/210067

>From 786456a6a0b4ab822889bc74bb7b1585bd3f038d Mon Sep 17 00:00:00 2001
From: hardikxk <[email protected]>
Date: Thu, 16 Jul 2026 19:50:38 +0530
Subject: [PATCH 1/2] Fix Unintialised char *CommentLexer resulting in
 potential UB.

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

closes #210034
---
 clang/include/clang/AST/CommentLexer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/include/clang/AST/CommentLexer.h 
b/clang/include/clang/AST/CommentLexer.h
index 194a31cb7b934..7e224f4d4cfb2 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;
 

>From 97c4ce48c807312ffaa25bcf676bde56623bec9f Mon Sep 17 00:00:00 2001
From: hardikxk <[email protected]>
Date: Thu, 16 Jul 2026 20:27:25 +0530
Subject: [PATCH 2/2] change initialization form

---
 clang/include/clang/AST/CommentLexer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/include/clang/AST/CommentLexer.h 
b/clang/include/clang/AST/CommentLexer.h
index 7e224f4d4cfb2..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{nullptr};
+  const char *CommentEnd = nullptr;
 
   SourceLocation FileLoc;
 

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to