Skip to content

Structure offset is counted twice in WrappedComposite.get_raw_pointer() #22

Description

@uentity

If you look at how composite fields parsing (from schema) algorithm is implemented, you will see that offsets of fields include the overall structure offset WrappedComposite.offset.

Then, get_raw_pointer(self, key) does the following:

p = self.pointers[key]
p.enum = None
return Pointer(self.offset + p.offset, p.value, p.size)

I.e. it adds the self.offset once again resulting in wrong pointer placement.

I fixed this by simply removing the self.offset term and this change fixed my data parsing pipeline.
Not sure if similar fix is required in WrappedComposite.__getitem__().

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions