Skip to content

feat: add overlap() to merge 2 FileStructure objects#2635

Open
VulnX wants to merge 2 commits intoGallopsled:devfrom
VulnX:feat/overlap-file-structs
Open

feat: add overlap() to merge 2 FileStructure objects#2635
VulnX wants to merge 2 commits intoGallopsled:devfrom
VulnX:feat/overlap-file-structs

Conversation

@VulnX
Copy link

@VulnX VulnX commented Oct 10, 2025

Closes: #2634

What does this PR add?

This PR adds an overlap() method to the existing FileStructure class which allows the user to merge 2 FileStructure objects. This is particularly useful when we have overlapping structs linked via the ->chain field.

Apart from the main overlap() method, for convenience, this PR also introduces 2 new methods:

  1. from_bytes() - a class method which allows the user to create a FileStructure object from a byte string
  2. offsets() - exports the architecture-specific offsets for all fields of the struct. This will also be very helpful in case the user wants to manually construct the fields with flat(), and use sane names like offsets['vtable'] instead of hard-coded numbers like 216

Does this PR modify any existing code?

No

@peace-maker
Copy link
Member

Do you think this can be done with the generic overlap function from #2647? So we just keep the from_bytes and offsets helpers, but merging of file structs can be done on the bytes representation? Or do you have additional logic in your overlap function that needs to be preserved?

@peace-maker
Copy link
Member

#2647 was merged. How can this PR be moved forward?

@VulnX
Copy link
Author

VulnX commented Feb 25, 2026

Hey @peace-maker, sorry for the delay in response.
Yes I believe we can retain from_bytes and offsets while ensuring that overlap acts as a clean wrapper around the more generic version in #2647.

I will push the changes soon.

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.

Overlap 2 file pointer structures for FSOP

2 participants