Skip to content

Validate index rowid position and report corrupt records#5473

Open
kumarUjjawal wants to merge 2 commits intotursodatabase:mainfrom
kumarUjjawal:fix/integrity_check_rowid
Open

Validate index rowid position and report corrupt records#5473
kumarUjjawal wants to merge 2 commits intotursodatabase:mainfrom
kumarUjjawal:fix/integrity_check_rowid

Conversation

@kumarUjjawal
Copy link
Contributor

Description

  • Add index rowid-position validation in integrity_check with header-level parsing and a dedicated IndexRecordCorrupt error.
  • Avoid brittle index-page assumptions in tests by reading rootpage from sqlite_master.
  • Add integration test that corrupts an index record header to ensure detection.

Motivation and context

Closes #5440

Description of AI Usage

Pair programming with codex

Copy link

@turso-bot turso-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review @jussisaurio

@kumarUjjawal kumarUjjawal force-pushed the fix/integrity_check_rowid branch from e687490 to 9dfe1b8 Compare February 20, 2026 05:00
@jussisaurio
Copy link
Collaborator

Does SQLite do this using VDBE or specialized non-VDBE code as here?

@kumarUjjawal
Copy link
Contributor Author

SQLite runs integrity_check through VDBE, but the heavy lifting is done by a dedicated opcode that delegates to non‑VDBE btree integrity code.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

integrity check should check for rowid-not-and-end-of-record violations

2 participants