about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2016-01-08 16:32:39 +0100
committerAjax <commial@gmail.com>2016-01-08 16:32:39 +0100
commit44cc82252eb55ab7e1c915780ca8a86e3155f075 (patch)
tree3438e530bd91e7945a3a5f43f29a8804ae4bd3c4
parentadb97c99ad7e9e9a40480609b5633dc2e1e9b0ce (diff)
downloadmiasm-44cc82252eb55ab7e1c915780ca8a86e3155f075.tar.gz
miasm-44cc82252eb55ab7e1c915780ca8a86e3155f075.zip
BinStream: ensure atomic mode state before switching
-rw-r--r--miasm2/core/bin_stream.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/miasm2/core/bin_stream.py b/miasm2/core/bin_stream.py
index 739e671e..074290af 100644
--- a/miasm2/core/bin_stream.py
+++ b/miasm2/core/bin_stream.py
@@ -38,11 +38,13 @@ class bin_stream(object):
 
     def enter_atomic_mode(self):
         """Enter atomic mode. In this mode, read may be cached"""
+        assert not self._atomic_mode
         self._atomic_mode = True
         self._cache = BoundedDict(self.CACHE_SIZE)
 
     def leave_atomic_mode(self):
         """Leave atomic mode"""
+        assert self._atomic_mode
         self._atomic_mode = False
         self._cache = None