Skip to content

Fix null pointer crash in WriteUnpreparedTxn::GetIterator#14459

Open
omkarhgawde wants to merge 1 commit into
facebook:mainfrom
omkarhgawde:export-D95303545
Open

Fix null pointer crash in WriteUnpreparedTxn::GetIterator#14459
omkarhgawde wants to merge 1 commit into
facebook:mainfrom
omkarhgawde:export-D95303545

Conversation

@omkarhgawde

Copy link
Copy Markdown
Contributor

Summary:
WriteUnpreparedTxnDB::NewIterator() can return nullptr when
largest_validated_seq_ exceeds the snapshot sequence and unprep_seqs_
is non-empty. The caller WriteUnpreparedTxn::GetIterator() only guards
against this with assert(db_iter), which is a no-op in release builds.
The null pointer is then passed to NewIteratorWithBase(), causing a crash.

Fix: Add an explicit null check and return a NewErrorIterator with a
Corruption status.

Differential Revision: D95303545

Summary:
`WriteUnpreparedTxnDB::NewIterator()` can return nullptr when
`largest_validated_seq_` exceeds the snapshot sequence and `unprep_seqs_`
is non-empty. The caller `WriteUnpreparedTxn::GetIterator()` only guards
against this with `assert(db_iter)`, which is a no-op in release builds.
The null pointer is then passed to `NewIteratorWithBase()`, causing a crash.

Fix: Add an explicit null check and return a NewErrorIterator with a
Corruption status.

Differential Revision: D95303545
@meta-cla meta-cla Bot added the CLA Signed label Mar 12, 2026
@meta-codesync

meta-codesync Bot commented Mar 12, 2026

Copy link
Copy Markdown

@omkarhgawde has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95303545.

@github-actions

Copy link
Copy Markdown

✅ clang-tidy: No findings on changed lines

Completed in 106.1s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment