diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-08-24 13:19:44 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-08-25 20:38:15 +0200 |
commit | 6564992f2464e561d11f82f65731bc0c44ea9e2a (patch) | |
tree | c420456e1c896bc814b1c1a63a853202c48f9639 | |
parent | ba38eff1c22cab91fc1a47a24dc7c03a458640aa (diff) |
main.c: do not dump operands of extended opcodes
Extendend opcodes might have non-opcode operands which we cannot safely
dereference.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | main.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -107,10 +107,12 @@ static void dump(struct ut_opcode *op, int level) { for (prev = NULL, cur = op; cur; prev = cur, cur = cur->sibling) { dump_node(cur); - for (i = 0; i < sizeof(cur->operand) / sizeof(cur->operand[0]); i++) { - if (cur->operand[i]) { - dump(cur->operand[i], level + 1); - printf("n%p -> n%p [label=\"op%d\"];\n", cur, cur->operand[i], i + 1); + if (cur->type < __T_MAX) { + for (i = 0; i < sizeof(cur->operand) / sizeof(cur->operand[0]); i++) { + if (cur->operand[i]) { + dump(cur->operand[i], level + 1); + printf("n%p -> n%p [label=\"op%d\"];\n", cur, cur->operand[i], i + 1); + } } } |