[all-commits] [llvm/llvm-project] 5965fb: [clang-tidy] Fix a crash in bugprone-not-null-term...
Aleksandr Platonov via All-commits
all-commits at lists.llvm.org
Mon Aug 10 00:27:05 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 5965fbf81b25217c40b09b48bd808a8f4a5d4e89
https://github.com/llvm/llvm-project/commit/5965fbf81b25217c40b09b48bd808a8f4a5d4e89
Author: Aleksandr Platonov <platonov.aleksandr at huawei.com>
Date: 2020-08-10 (Mon, 10 Aug 2020)
Changed paths:
M clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
A clang-tools-extra/test/clang-tidy/checkers/bugprone-not-null-terminated-result-undef-stdc-want-lib-ext1.c
Log Message:
-----------
[clang-tidy] Fix a crash in bugprone-not-null-terminated-result check when `__STDC_WANT_LIB_EXT1__` was undefined after definition.
PP->getMacroInfo() returns nullptr for undefined macro, so we need to check this return value before dereference.
Stack dump:
```
#0 0x0000000002185e6a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/llvm-project/build/bin/clang-tidy+0x2185e6a)
#1 0x0000000002183e8c llvm::sys::RunSignalHandlers() (/llvm-project/build/bin/clang-tidy+0x2183e8c)
#2 0x0000000002183ff3 SignalHandler(int) (/llvm-project/build/bin/clang-tidy+0x2183ff3)
#3 0x00007f37df9b1390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x000000000052054e clang::tidy::bugprone::NotNullTerminatedResultCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/llvm-project/build/bin/clang-tidy+0x52054e)
```
Reviewed By: hokein
Differential Revision: https://reviews.llvm.org/D85523
More information about the All-commits
mailing list