[clang] Fix Unintialised char *CommentLexer resulting in potential UB. (PR #210067)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 16 07:22:34 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Hardik Kumar (hardikxk)
<details>
<summary>Changes</summary>
The patch intialised the pointer to a .
Previously the pointer would have some garbage value which might have resulted in UB.
closes #<!-- -->210034
---
Full diff: https://github.com/llvm/llvm-project/pull/210067.diff
1 Files Affected:
- (modified) clang/include/clang/AST/CommentLexer.h (+1-1)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/210067
More information about the cfe-commits
mailing list