Commit 6eba08b6 authored by Daniel Clifford's avatar Daniel Clifford Committed by Commit Bot

[torque] Fix invalid iterator bug in Type Oracle

The aggregate type finalization loop in the Type Oracle can cause new
types to be added to the type list during finalization, invalidating
the iterator used in the container-iterating "for" loop. To fix this,
visit using an explicit index rather than using a iterator-based for
loop.

Change-Id: I2fb486043c946a492d972f1e942e3b5e331a1cea
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2007499
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65860}
parent dd9e0190
...@@ -25,7 +25,9 @@ TypeOracle::GetBitFieldStructTypes() { ...@@ -25,7 +25,9 @@ TypeOracle::GetBitFieldStructTypes() {
// static // static
void TypeOracle::FinalizeAggregateTypes() { void TypeOracle::FinalizeAggregateTypes() {
for (const std::unique_ptr<AggregateType>& p : Get().aggregate_types_) { size_t current = 0;
while (current != Get().aggregate_types_.size()) {
auto& p = Get().aggregate_types_[current++];
p->Finalize(); p->Finalize();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment