From 2c5b6e1a1c406cbe06e2d6f77861764ebd01b9ce Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 30 Dec 2019 09:19:25 +1030 Subject: [PATCH] Re: Usage of unitialized heap in tic4x_print_cond PR 25319 * tic4x-dis.c (tic4x_print_cond): Correct order of xcalloc args. --- opcodes/ChangeLog | 5 +++++ opcodes/tic4x-dis.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index bde9b921666..5021447c18b 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2019-12-30 Alan Modra + + PR 25319 + * tic4x-dis.c (tic4x_print_cond): Correct order of xcalloc args. + 2019-12-29 Alan Modra * sparc-dis.c (SEX): Don't use left and right shift to sign extend. diff --git a/opcodes/tic4x-dis.c b/opcodes/tic4x-dis.c index 01cfa1e060f..e058fdc9f8a 100644 --- a/opcodes/tic4x-dis.c +++ b/opcodes/tic4x-dis.c @@ -277,7 +277,7 @@ tic4x_print_cond (struct disassemble_info *info, unsigned int cond) if (condtable == NULL) { - condtable = xcalloc (sizeof (tic4x_cond_t *), 32); + condtable = xcalloc (32, sizeof (tic4x_cond_t *)); for (i = 0; i < tic4x_num_conds; i++) condtable[tic4x_conds[i].cond] = (tic4x_cond_t *)(tic4x_conds + i); } -- 2.30.2