about summary refs log tree commit diff stats
path: root/miasm2/core/bin_stream_ida.py
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/core/bin_stream_ida.py')
-rw-r--r--miasm2/core/bin_stream_ida.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/miasm2/core/bin_stream_ida.py b/miasm2/core/bin_stream_ida.py
index ff88f03e..62c06c9e 100644
--- a/miasm2/core/bin_stream_ida.py
+++ b/miasm2/core/bin_stream_ida.py
@@ -1,4 +1,4 @@
-from idc import Byte
+from idc import Byte, SegEnd
 
 from miasm2.core.bin_stream import bin_stream_str
 
@@ -7,8 +7,6 @@ class bin_stream_ida(bin_stream_str):
     """
     bin_stream implementation for IDA
 
-    IDA should provide Byte function
-
     Don't generate xrange using address computation:
     It can raise error on overflow 7FFFFFFF with 32 bit python
     """
@@ -20,22 +18,16 @@ class bin_stream_ida(bin_stream_str):
 
     def readbs(self, l=1):
         if self.offset + l > self.l:
-            raise IOError
+            raise IOError("not enough bytes")
         o = self.getbytes(self.offset)
         self.offset += l
         return p
 
-    def writebs(self, l=1):
-        raise ValueError('writebs unsupported')
-
     def __str__(self):
         raise NotImplementedError('Not fully functional')
 
     def setoffset(self, val):
         self.offset = val
 
-    def __len__(self):
-        return 0x7FFFFFFF
-
     def getlen(self):
-        return 0x7FFFFFFF - self.offset - self.shift
+        return SegEnd(0) - (self.offset + self.shift)