diff options
| author | Camille Mougey <commial@gmail.com> | 2019-01-15 09:18:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-15 09:18:20 +0100 |
| commit | a482a485d215adc8c178d3b3ce8305b296bf62b5 (patch) | |
| tree | 2f9d1b360727c8705290a87c547d30876e164506 | |
| parent | b18334c3aa4094086e8395e2ffa78faf8b1bf361 (diff) | |
| parent | 6a00c9f88daa66341ad474a7509b4d186d37def4 (diff) | |
| download | miasm-a482a485d215adc8c178d3b3ce8305b296bf62b5.tar.gz miasm-a482a485d215adc8c178d3b3ce8305b296bf62b5.zip | |
Merge pull request #940 from serpilliere/fix_ida_bin_stream_mapped
Examples/IDA: raise IOError on read out of range
Diffstat (limited to '')
| -rw-r--r-- | miasm2/core/bin_stream_ida.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/miasm2/core/bin_stream_ida.py b/miasm2/core/bin_stream_ida.py index de7bc971..f63077bf 100644 --- a/miasm2/core/bin_stream_ida.py +++ b/miasm2/core/bin_stream_ida.py @@ -1,5 +1,6 @@ from idc import Byte, SegEnd from idautils import Segments +from idaapi import is_mapped from miasm2.core.bin_stream import bin_stream_str @@ -14,7 +15,10 @@ class bin_stream_ida(bin_stream_str): def _getbytes(self, start, l=1): o = "" for ad in xrange(l): - o += chr(Byte(ad + start - self.shift)) + offset = ad + start - self.shift + if not is_mapped(offset): + raise IOError("not enough bytes") + o += chr(Byte(offset)) return o def readbs(self, l=1): |