diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2024-03-29 22:13:01 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-29 22:13:01 +0000 |
| commit | db95ed7cdd0a23c1b3d9f46bcba3dd9a08cdd957 (patch) | |
| tree | 8f6b7fe93be9d618c08eb17614c37fe8231e2be7 /src/llvm_backend_debug.cpp | |
| parent | 8899f42478a7735e81cd25cc9c6c81ce18f79df1 (diff) | |
| parent | 915f63b3f92bc17e4a5875623f46e167dcd17322 (diff) | |
Merge pull request #3353 from laytan/fix-incomplete-types-resize-segfault
fix a segfault when incomplete types array resizes while processing
Diffstat (limited to 'src/llvm_backend_debug.cpp')
| -rw-r--r-- | src/llvm_backend_debug.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/llvm_backend_debug.cpp b/src/llvm_backend_debug.cpp index c06026568..9ecacb4f4 100644 --- a/src/llvm_backend_debug.cpp +++ b/src/llvm_backend_debug.cpp @@ -652,7 +652,9 @@ gb_internal void lb_debug_complete_types(lbModule *m) { for_array(debug_incomplete_type_index, m->debug_incomplete_types) { TEMPORARY_ALLOCATOR_GUARD(); - auto const &idt = m->debug_incomplete_types[debug_incomplete_type_index]; + // NOTE(laytan): don't make this a pointer, the array could resize while in this iteration + // and cause a use-after-free at the end. + auto const idt = m->debug_incomplete_types[debug_incomplete_type_index]; GB_ASSERT(idt.type != nullptr); GB_ASSERT(idt.metadata != nullptr); |