Skip to content

Fix SQLite3 Cell data overflow reading for databases with header.reserved_size set#25

Merged
Schamper merged 5 commits intofox-it:mainfrom
JSCU-CNI:sqlite-fix-cell-data-overflow-reading
Feb 6, 2026
Merged

Fix SQLite3 Cell data overflow reading for databases with header.reserved_size set#25
Schamper merged 5 commits intofox-it:mainfrom
JSCU-CNI:sqlite-fix-cell-data-overflow-reading

Conversation

@JSCU-CNI
Copy link
Contributor

@JSCU-CNI JSCU-CNI commented Feb 2, 2026

This PR fixes Cell.data reading for databases when parsing a cell value larger than the (usable) page size. Currently the overflow page lookup implementation does not calculate the data_size correctly for databases with header.reserved_size set.

@Schamper
Copy link
Member

Schamper commented Feb 3, 2026

You know the question that's coming: is it possible to have some test data for this edge case?

Also @PimSanders since you've been looking into SQLite for a little while now, what are your thoughts on this?

@JSCU-CNI
Copy link
Contributor Author

JSCU-CNI commented Feb 3, 2026

You know the question that's coming: is it possible to have some test data for this edge case?

The PR for #17 will include test data that covers this change.

@JSCU-CNI
Copy link
Contributor Author

JSCU-CNI commented Feb 3, 2026

Added a separate test for this case in 3a09e78.

@PimSanders
Copy link
Contributor

I think I understand where this issue comes from and how the fix works. Seems to me like a good fix for the issue.

Only thing I noticed is that self.page.sqlite.usable_page_size is the same as self.sqlite.usable_page_size, which might make the code a tiny bit more readable.

Haven't been able to test it yet, so correct me if I'm wrong.

Schamper
Schamper previously approved these changes Feb 6, 2026
@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (f75cabe) to head (7c44bf1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dissect/database/sqlite3/sqlite3.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main     #25   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        146     146           
  Lines       3880    3879    -1     
=====================================
+ Misses      3880    3879    -1     
Flag Coverage Δ
unittests 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@Schamper Schamper left a comment

Choose a reason for hiding this comment

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

TIL ruff lints Python inside docstrings.

@Schamper Schamper merged commit e05997f into fox-it:main Feb 6, 2026
21 checks passed
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 6, 2026

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing JSCU-CNI:sqlite-fix-cell-data-overflow-reading (7c44bf1) with main (f75cabe)

Open in CodSpeed

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.

3 participants