Skip to content

fix(storage): fail fast on out-of-bounds PIP/header page reads - #946

Draft
adsharma wants to merge 1 commit into
fix/840-null-scan-memmovefrom
fix/843-pip-bounds-validation
Draft

fix(storage): fail fast on out-of-bounds PIP/header page reads#946
adsharma wants to merge 1 commit into
fix/840-null-scan-memmovefrom
fix/843-pip-bounds-validation

Conversation

@adsharma

@adsharma adsharma commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Related to #843.

A corrupted page-index-pointer (PIP) chain turned into a wild pread far beyond EOF (position: 4727899947008 on a 2884-page file), surfacing as a cryptic IO error on every open, including read_only.

  • FileHandle::readPageFromDisk: runtime bounds check throwing RuntimeException naming the offending page and file size (DASSERT alone is stripped in release).
  • PIPWrapper ctor and DiskArrayCollection header-chain walk: validate PIP/header indices before reading.

This converts an unopenable database with a misleading offset into an actionable corruption error, following the existing validateCheckpointPageRange pattern in checkpointer.cpp. It does not fix the original misdirected write — that writer is still unknown — but it bounds the blast radius and makes the next occurrence diagnosable.

Corrupted page-index-pointer (PIP) chains previously issued wild preads
far beyond EOF (issue #843: position 4727899947008 on a 2884-page file),
surfacing as a cryptic IO error on every open, including read-only.

Validate page indices against the file size before reading:
- FileHandle::readPageFromDisk now throws a RuntimeException naming the
  offending page and file size (DASSERT alone is stripped in release).
- PIPWrapper and DiskArrayCollection header-chain walk check PIP/header
  indices up front.

This converts an unopenable database with a misleading offset into an
actionable corruption error, and follows the existing
validateCheckpointPageRange pattern in checkpointer.cpp.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant