Fix chunked reading of ELF files#865
Conversation
|
This is technically a bug that has existed since the ELF module was introduced in 8252b6c. It hasn't ever broken anything before, and I'm hesitant about back-porting this medium-sized change. I'm in the process of writing more tests, but it requires additional changes to |
9ecd1a8 to
584495f
Compare
This introduces a new dependency on 'intervaltree', which is used to automatically select segments which are relevant for a given virtual-address range. This also introduces a new ELF.memory attribute, which is the tree of memory ranges, which point at the segment objects that describe the memory range. These are recalculated when ELF.address is adjusted, and we have tests for that. This also optimizes some of the other routines to avoid the wrapped file-seeking, and to just use the mmap.
6f4fe5d to
aa8f8ec
Compare
|
Greatly reduced the size of the changes, and added some changes to It turns out that Ubuntu's Zesty packages -- for these specific packages -- run just fine on Precise. There's no need to pull from the Pwntools PPA. |
|
Ping @idolf for review |
|
Restarted a new copy of the Travis build after deleting the cache files for this PR, to ensure that there are no lingering "broken but it's in cache so it works" issues. |
There was a problem hiding this comment.
LGTM.
Is there an easy way to add a test the hits a few of the edge cases of this? (e.g. non-continuous segments, overlapping segments)
|
If you look at the changes, you should see there are tests for one of those scenarios (read spans non-contiguous segments). I can't get What we could do is just have each |
|
Added bad24ee to address the second half of #865 (review) |
This introduces a new dependency on 'intervaltree', which is used
to automatically select segments which are relevant for a given
virtual-address range.
This also introduces a new ELF.memory attribute, which is the tree
of memory ranges, which point at the segment objects that describe
the memory range.
These are recalculated when ELF.address is adjusted, and we have
tests for that.
This also optimizes some of the other routines to avoid the wrapped
file-seeking, and to just use the mmap.
Fixes #864