diff options
author | Alejandro Álvarez Ayllón <alejandro.alvarez@sonarsource.com> | 2025-02-19 16:19:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-19 07:19:31 -0800 |
commit | 26a83994176fcdca6e77be4f221a15f561681621 (patch) | |
tree | 807aeb91c633a89f95b2c5bf4f43d36b1e579805 /clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | |
parent | fb5a87e1a6febb2a81fd85f800e78c2e6dff5715 (diff) | |
download | llvm-26a83994176fcdca6e77be4f221a15f561681621.zip llvm-26a83994176fcdca6e77be4f221a15f561681621.tar.gz llvm-26a83994176fcdca6e77be4f221a15f561681621.tar.bz2 |
[clang][Sema] Fix initialization of `NonTypeTemplateParmDecl`... (#121768)
...when there are invalid constraints.
When attaching a `TypeConstraint`, in case of error, the trailing
pointer that is supposed to point to the constraint is left
uninitialized.
Sometimes the uninitialized value will be a `nullptr`, but at other
times it will not. If we traverse the AST (for instance, dumping it, or
when writing the BMI), we may get a crash depending on the value that
was left. The serialization may also contain a bogus value.
In this commit, we always initialize the `PlaceholderTypeConstraint`
with `nullptr`, to avoid accessing this uninitialized memory.
This does not affect only modules, but it causes a segfault more
consistently when they are involved.
The test case was reduced from `mp-units`.
---------
Co-authored-by: Erich Keane <ekeane@nvidia.com>
Diffstat (limited to 'clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions