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

Retain u64 size for class and union sizes #103

Merged
merged 3 commits into from
May 20, 2022
Merged

Conversation

landaire
Copy link
Contributor

@landaire landaire commented Apr 26, 2021

I encountered a PDB which contained a type looking something like this:

ClassType {
    kind: Struct,
    count: 0x10,
    properties: TypeProperties(
        0x200,
    ),
    fields: Some(
        TypeIndex(0x5326),
    ),
    derived_from: None,
    vtable_shape: None,
    size: 0x5D00,
    name: RawString("_REDACTED_DATA"),
    unique_name: Some(
        RawString(".?AU_REDACTED_DATA@@"),
    ),
}

I noticed something weird about all structs containing this one: all of them had incorrect field offsets (calculated by me) and incorrect sizes. Upon further observation I noticed that the size had been truncated from 0xF5D00 to 0x5D00. This patch removes the integer truncation from classes/structs (tested) and from unions (untested) and changes their types to be u64.

@landaire
Copy link
Contributor Author

I also realized MemberType::offset is provided by this crate, not by me, and is also wrong. I've fixed that as well. Might be worth it to audit count/length-based integers where parse_unsigned() is called and truncated for similar issues.

Copy link
Member

@jan-auer jan-auer left a comment

Choose a reason for hiding this comment

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

Great catch, thank you!

@jan-auer jan-auer merged commit 98e2529 into getsentry:master May 20, 2022
@jan-auer jan-auer mentioned this pull request May 20, 2022
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.

None yet

2 participants