[all-commits] [llvm/llvm-project] 0387a8: [clang][modules] Fix use-after-free in header seri...
Jan Svoboda via All-commits
all-commits at lists.llvm.org
Mon Jul 8 09:27:05 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0387a86f9a6d5bb0f178804784296e37fb34ca03
https://github.com/llvm/llvm-project/commit/0387a86f9a6d5bb0f178804784296e37fb34ca03
Author: Jan Svoboda <jan_svoboda at apple.com>
Date: 2024-07-08 (Mon, 08 Jul 2024)
Changed paths:
M clang/lib/Serialization/ASTWriter.cpp
A clang/test/Modules/use-after-free-2.c
Log Message:
-----------
[clang][modules] Fix use-after-free in header serialization (#96356)
With the pruning of unused module map files disabled
(`-fno-modules-prune-non-affecting-module-map-files`), `HeaderFileInfo`
no longer gets deserialized before `ASTWriter::WriteHeaderSearch()`.
This function then interleaves the stores of references to `KnownHeader`
with their lazy deserialization. Lazy deserialization may cause
reallocation of `ModuleMap::Headers` entries (including its
`SmallVector<KnownHeader, 1>` values) thus making previously-stored
`ArrayRef<KnownHeader>` dangling. This patch fixes that situation by
storing a copy instead.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list