Skip to content

Commit e1b1232

Browse files
committed
DPL: add guard for unsafe cursor
1 parent a684e5a commit e1b1232

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Framework/Core/include/Framework/AnalysisHelpers.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,14 @@ struct WritingCursor {
514514
requires(sizeof...(Ts) == framework::pack_size(typename persistent_table_t::persistent_columns_t{}))
515515
{
516516
++mCount;
517+
if (mReserved >= 0 && mCount >= mReserved) [[unlikely]] {
518+
// reserve() switched this cursor to UnsafeAppend, which does not grow its
519+
// buffers. Writing row mCount (>= the reserved count) would overrun them and
520+
// silently corrupt the heap, so fail here, naming the offending table and
521+
// row, rather than crashing later somewhere unrelated.
522+
LOG(fatal) << "Table '" << outputSpec.binding.value << "': writing row " << mCount
523+
<< " exceeds reserve(" << mReserved << ").";
524+
}
517525
cursor(0, extract(args)...);
518526
}
519527

0 commit comments

Comments
 (0)