diff options
author | Emilia Kond <emilia@rymiel.space> | 2024-02-22 20:22:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-22 20:22:05 +0200 |
commit | 2e7cacfced573283d5424830f20333e2a6731251 (patch) | |
tree | d99ea20b3a3d00df11a26bd1c31830d2d882846d /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 54a6cf15069e7e88125477e0b3ce1ab063c893c6 (diff) | |
download | llvm-2e7cacfced573283d5424830f20333e2a6731251.zip llvm-2e7cacfced573283d5424830f20333e2a6731251.tar.gz llvm-2e7cacfced573283d5424830f20333e2a6731251.tar.bz2 |
[clang-format] Fix crash in TokenAnnotator (#82349)
The while loop on line 3814 can cause a segmentation fault getting the
Next field on a nullptr. This is because further down, on line 3823,
there is another for loop, which assigns Tok to Tok->Next in its
initializer. This for loop has a condition to check if the result of
that isn't null. If it is, the loop is skipped and we drop back out to
the outer loop, except, now Tok is null, and we try to dereference it
without checking first.
This patch adds a defensive check that returns if Tok->Next is null
before we make it to the second for loop.
Fixes https://github.com/llvm/llvm-project/issues/82328
---------
Co-authored-by: Owen Pan <owenpiano@gmail.com>
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions