Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

directory_iterator: fix potential over-/underflow #131

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

Gottox
Copy link
Owner

@Gottox Gottox commented Sep 7, 2023

This change improves the inode calculation in the directory iterators. Before this change the inode was checked in check_inode_consistency() and then calculated naively in directory_iterator_inode(). After this change the inode is precalculated, checked more intensively and cached in update_inode(). director_iterator_inode() is a simple getter for the cached value.

This change also includes test cases for the directory iterator that check the new behavior.

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Patch coverage: 87.50% and project coverage change: +0.01% 🎉

Comparison is base (8e52424) 60.22% compared to head (34216be) 60.24%.

❗ Current head 34216be differs from pull request most recent head 2d79e60. Consider uploading reports for the commit 2d79e60 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #131      +/-   ##
==========================================
+ Coverage   60.22%   60.24%   +0.01%     
==========================================
  Files          58       58              
  Lines        4767     4769       +2     
  Branches      716      718       +2     
==========================================
+ Hits         2871     2873       +2     
  Misses       1481     1481              
  Partials      415      415              
Files Changed Coverage Δ
lib/read/directory/directory_iterator.c 76.19% <87.50%> (+0.20%) ⬆️

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

@Gottox Gottox force-pushed the fix/directory-inode-calculation branch 2 times, most recently from 6ecb4bc to 34216be Compare September 7, 2023 12:50
This change improves the inode calculation in the directory iterators.
Before this change the inode was checked in check_inode_consistency()
and then calculated naively in directory_iterator_inode().
After this change the inode is precalculated, checked more intensively
and cached in update_inode(). director_iterator_inode() is a simple
getter for the cached value.

This change also includes test cases for the directory iterator that
check the new behavior.
@Gottox Gottox force-pushed the fix/directory-inode-calculation branch from 34216be to 2d79e60 Compare September 7, 2023 12:52
@Gottox Gottox merged commit b6d02b9 into main Sep 7, 2023
21 checks passed
@Gottox Gottox deleted the fix/directory-inode-calculation branch September 7, 2023 13:07
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