about summary refs log tree commit diff stats
path: root/miasm2/jitter/codegen.py
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/jitter/codegen.py')
-rw-r--r--miasm2/jitter/codegen.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/miasm2/jitter/codegen.py b/miasm2/jitter/codegen.py
index 540509bf..1ce7ba6d 100644
--- a/miasm2/jitter/codegen.py
+++ b/miasm2/jitter/codegen.py
@@ -370,14 +370,23 @@ class CGen(object):
 
         @attrib: an Attributs instance
         @instr_offsets: list of instructions offsets
-        @dst2index: link from dstination to index
+        @dst2index: link from destination to index
         """
 
         if not dst2index:
             return []
         out = []
         out.append('switch(DST_case) {')
+
+        stopcase = False
         for dst, index in sorted(dst2index.iteritems(), key=lambda lblindex: lblindex[1]):
+            if index == -1:
+                # Handle '-1' case only once
+                if not stopcase:
+                    stopcase = True
+                else:
+                    continue
+
             out.append('\tcase %d:' % index)
             out += self.gen_goto_code(attrib, instr_offsets, dst)
             out.append('\t\tbreak;')