workflow_objc icon indicating copy to clipboard operation
workflow_objc copied to clipboard

Fixed handling of ivars with null offset pointer

Open tanakalian opened this issue 2 years ago • 1 comments

For some binaries ivars can have an offset pointer value of 0, which means attempting to read at that offset will fail and break analysis. Adding a check for a null offset pointer fixes this.

tanakalian avatar May 04 '23 00:05 tanakalian

Thanks for the PR! This fix is fine in theory, but some side effects need to be investigated before merging.

With this change, the offset field will never be set for some IvarInfo instances, which means this code could create members at random offsets, since the offset field of IvarInfo is not initialized by default.

I'd say that field should be default-initialized to zero and a flag should be added to indicate if it is genuinely zero or was never set (or initialize to and check for UINT32_MAX, use std::optional, etc.). The instance variable stuff is @cxnder's code, so I'm going to defer to her judgement here since I only took a cursory glance at the code I expected to be affected by this change.

There is no action needed on your end at this time, @tanakalian. We'll take care of the necessary fixes.

jonpalmisc avatar May 08 '23 14:05 jonpalmisc

Thank you so much for contributing! As we ended up moving structural analysis into Mach-O View itself, this PR unfortunately is no longer applicable. The issue should ideally be fixed there.

Again, thank you!

0cyn avatar Jun 11 '24 19:06 0cyn