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.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/miasm2/core/bin_stream_ida.py b/miasm2/core/bin_stream_ida.py
index fcd89f9f..44cf9367 100644
--- a/miasm2/core/bin_stream_ida.py
+++ b/miasm2/core/bin_stream_ida.py
@@ -1,7 +1,9 @@
+from builtins import range
 from idc import Byte, SegEnd
 from idautils import Segments
 from idaapi import is_mapped
 
+from miasm2.core.utils import int_to_byte
 from miasm2.core.bin_stream import bin_stream_str
 
 
@@ -13,13 +15,13 @@ class bin_stream_ida(bin_stream_str):
     It can raise error on overflow 7FFFFFFF with 32 bit python
     """
     def _getbytes(self, start, l=1):
-        o = ""
-        for ad in xrange(l):
+        out = []
+        for ad in range(l):
             offset = ad + start + self.base_address
             if not is_mapped(offset):
                 raise IOError("not enough bytes")
-            o += chr(Byte(offset))
-        return o
+            out.append(int_to_byte(Byte(offset)))
+        return b''.join(out)
 
     def readbs(self, l=1):
         if self.offset + l > self.l: