about summary refs log tree commit diff stats
path: root/miasm/core
diff options
context:
space:
mode:
Diffstat (limited to 'miasm/core')
-rw-r--r--miasm/core/graph.py2
-rw-r--r--miasm/core/utils.py7
2 files changed, 7 insertions, 2 deletions
diff --git a/miasm/core/graph.py b/miasm/core/graph.py
index e680894c..debea38e 100644
--- a/miasm/core/graph.py
+++ b/miasm/core/graph.py
@@ -20,7 +20,7 @@ class DiGraph(object):
         # N -> Nodes N2 with a edge (N2 -> N)
         self._nodes_pred = {}
 
-        self.escape_chars = re.compile(r'[\{\}&|<>]')
+        self.escape_chars = re.compile('[' + re.escape('{}[]') + '&|<>' + ']')
 
 
     def __repr__(self):
diff --git a/miasm/core/utils.py b/miasm/core/utils.py
index eb170576..291c5f4d 100644
--- a/miasm/core/utils.py
+++ b/miasm/core/utils.py
@@ -26,7 +26,9 @@ COLOR_OP = "black"
 
 COLOR_MNEMO = "blue1"
 
-ESCAPE_CHARS = re.compile(r'[\{\}&|<>]')
+ESCAPE_CHARS = re.compile('[' + re.escape('{}[]') + '&|<>' + ']')
+
+
 
 def set_html_text_color(text, color):
     return '<font color="%s">%s</font>' % (color, text)
@@ -39,6 +41,9 @@ def _fix_chars(token):
 def fix_html_chars(text):
     return ESCAPE_CHARS.sub(_fix_chars, str(text))
 
+BRACKET_O = fix_html_chars('[')
+BRACKET_C = fix_html_chars(']')
+
 upck8 = lambda x: struct.unpack('B', x)[0]
 upck16 = lambda x: struct.unpack('H', x)[0]
 upck32 = lambda x: struct.unpack('I', x)[0]