Skip to content

Fix recovered offset allocation range check - #162

Open
calculatetech wants to merge 2 commits into
libyal:mainfrom
calculatetech:fix/recovered-index-allocation
Open

Fix recovered offset allocation range check#162
calculatetech wants to merge 2 commits into
libyal:mainfrom
calculatetech:fix/recovered-index-allocation

Conversation

@calculatetech

Copy link
Copy Markdown

Summary

Recovered offset index entries were checked against the allocation map using zero-initialized local offset and size variables instead of the values parsed into the index value. This could reject recoverable entries based on an unrelated range at offset zero.

This change:

  • checks the parsed file offset and data size
  • keeps negative offsets classified as not recoverable
  • adds a focused regression test for ranges inside and outside the unallocated map

Testing

  • ./autogen.sh
  • ./configure --disable-static --disable-nls
  • make -j4
  • make check

All 47 library tests, 3 manpage tests, and 3 tool tests pass.

@joachimmetz

Copy link
Copy Markdown
Member

Thanks for the proposed changes, what's up reasoning behind the draft status of this PR?

@calculatetech
calculatetech marked this pull request as ready for review July 23, 2026 18:12
@calculatetech

Copy link
Copy Markdown
Author

Thanks for the proposed changes, what's up reasoning behind the draft status of this PR?

I'm still learning my way around github. My mistake.

@joachimmetz

Copy link
Copy Markdown
Member

Thanks for the additional context, I'll take a closer look as soon as time permits

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 29.33%. Comparing base (e9b304c) to head (e198d23).

Files with missing lines Patch % Lines
libpff/libpff_recover.c 72.72% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #162      +/-   ##
==========================================
+ Coverage   29.20%   29.33%   +0.13%     
==========================================
  Files          64       64              
  Lines       20854    20801      -53     
  Branches     5037     5040       +3     
==========================================
+ Hits         6090     6102      +12     
+ Misses      12818    12743      -75     
- Partials     1946     1956      +10     

☔ View full report in Codecov by Harness.
📢 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.

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.

2 participants