about summary refs log tree commit diff stats
path: root/miasm2/core/bin_stream_ida.py
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2015-02-11 13:37:19 +0100
committerCamille Mougey <commial@gmail.com>2015-02-11 13:37:19 +0100
commit5d0d3e5675005d38bfc926a3fe025182ade50720 (patch)
treef5bdc465d5d31a1013e88061dd3f0145f123b987 /miasm2/core/bin_stream_ida.py
parentdc916d52815feee22cc81a29fe1272278d4caefc (diff)
parentf68d21f7d8ec32d1378a403c4ccb0345f1d5ef56 (diff)
downloadmiasm-5d0d3e5675005d38bfc926a3fe025182ade50720.tar.gz
miasm-5d0d3e5675005d38bfc926a3fe025182ade50720.zip
Merge pull request #64 from serpilliere/bin_stream_no_len
Bin stream no len
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)