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

fix(pdb): skip reading rows of invalid pages #93

Merged
merged 1 commit into from
Oct 13, 2022

Conversation

Swiftb0y
Copy link
Contributor

as per doc of pdb::Page::page_flags certain
pages contain garbage data and thus should
not try to read rowdata.

fixes #72

as per doc of `pdb::Page::page_flags` certain
pages contain garbage data and thus should
not try to read rowdata.

fixes Holzhaus#72
@Swiftb0y
Copy link
Contributor Author

This solution just skips the rows but still reads the page (which then contains no rows). Alternatively one could check if the page has no data and then not add it to vector of pages. That solution would be a little more complicated though I fear.

Copy link
Owner

@Holzhaus Holzhaus left a comment

Choose a reason for hiding this comment

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

Thanks, good catch!

Comment on lines +185 to +193
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
struct PageFlags(u8);

impl PageFlags {
#[must_use]
pub fn page_has_data(&self) -> bool {
(self.0 & 0x40) == 0
}
}
Copy link
Owner

@Holzhaus Holzhaus Oct 12, 2022

Choose a reason for hiding this comment

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

We already have a dependency on the modular_bitfield crate, might make sense to use that instead:

#[bitfield]
pub struct PageFlags {
    unknown1: B1,
    no_data: bool,
    unknown2: B6,
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't know that, sure. I just don't know when I'll get around to it.

@Swiftb0y
Copy link
Contributor Author

Couldn't get modular_bitfield to play nice with clippy. Seems like the modular_bitfield codegen must be updated. modular_bitfield has not been updated in almost two years...

@Holzhaus
Copy link
Owner

Hmm, I think we are using it because it was suggested by the binrw docs. Maybe we need to switch? Maybe the bitflags crate can be used?

If you restore the original PR, I can merge it now to fix the bug and we just put further improvements on the TODO list a.k.a. the issue tracker.

@Swiftb0y
Copy link
Contributor Author

restored

@Swiftb0y Swiftb0y mentioned this pull request Oct 13, 2022
@Holzhaus Holzhaus merged commit db59ea4 into Holzhaus:main Oct 13, 2022
@Swiftb0y Swiftb0y deleted the pdb-skip-invalid-pages branch October 13, 2022 20:43
@Swiftb0y
Copy link
Contributor Author

Thanks

@Holzhaus
Copy link
Owner

Thanks for fixing.

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.

rekordcrate-pdb - Error: no variants matched at 0x307f
2 participants