aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread/Semaphore.zig
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2023-04-23 19:09:12 -0400
committerkcbanner <kcbanner@gmail.com>2023-04-27 01:11:57 -0400
commit2b592d7e3cf328deb1b8ffa7ea88389d785837ff (patch)
tree111892a8c4ef5301207a497382fe4fc6f51a3f4d /lib/std/Thread/Semaphore.zig
parent396bd51c4818752f6309ff10f2d316f41598d5cd (diff)
downloadzig-2b592d7e3cf328deb1b8ffa7ea88389d785837ff.tar.gz
zig-2b592d7e3cf328deb1b8ffa7ea88389d785837ff.zip
sema: Rework Decl.value_arena to fix another memory corruption issue
This fixes a bug where resolveStructLayout to was promoting from stale value_arena state which was then overwrriten when another ArenaAllocator higher in the call stack saved its state back. This resulted in the memory for struct_obj.optmized_order overlapping existing allocations. My initial fix in c7067ef wasn't sufficient, as it only checked if the struct being resolved had the same owner as the current sema instance. However, it's possible for resolveStructLayout to be called when the sema instance has a different owner, but the struct decl's value_arena is currently in use higher up in the callstack. This change introduces ValueArena, which holds the arena state as well as tracks if an arena has already been promoted from it. This allows callers to use the value_arena storage without needing to be aware of another user of this same storage higher up in the call stack.
Diffstat (limited to 'lib/std/Thread/Semaphore.zig')
0 files changed, 0 insertions, 0 deletions