Skip to content

Commit f76c6e8

Browse files
author
Grok Compression
committed
parse: avoid reparsing
1 parent c4c654b commit f76c6e8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/lib/core/tile_processor/TileProcessor.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,17 @@ void TileProcessor::scheduleAndRunDecompress(CoderPool* coderPool, Rect32 unredu
16871687
tileHeaderParseFlow_->addTo(*rootFlow_);
16881688
tileHeaderParseFlow_->conditional_precede(rootFlow_.get(), prepareFlow_.get(),
16891689
condition_lambda);
1690+
1691+
// The parse/prepare flows carry one-shot tasks (parseHeader, TileComponent::init)
1692+
// populated for THIS submission only. Consume them now by moving them into the
1693+
// in-flight holding pen: they stay alive there for the run below and are freed by
1694+
// the next submission's waitAndClear() + staleParsing_.clear(). This guarantees a
1695+
// second submission of the same tile that does not re-parse cannot compose and
1696+
// re-run these already-completed tasks — which previously double-executed
1697+
// parseHeader / TileComponent::init, causing double-free / use-after-free.
1698+
// (prepareConcurrentParsing() recreates fresh empty flows on the next parse.)
1699+
staleParsing_.push_back(std::move(tileHeaderParseFlow_));
1700+
staleParsing_.push_back(std::move(prepareFlow_));
16901701
}
16911702

16921703
concurrentFlowsStale_ = true;

0 commit comments

Comments
 (0)