aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-29 12:56:29 +1030
committerAlan Modra <amodra@gmail.com>2019-12-29 22:13:12 +1030
commit8c5e259235a4e4546910245b170de1e29a711034 (patch)
tree8a56d1b987297d5540efc823a907ecfbc3a83c24
parent401e101e0274d401e90e50cd8280a9ff36006477 (diff)
downloadgdb-8c5e259235a4e4546910245b170de1e29a711034.zip
gdb-8c5e259235a4e4546910245b170de1e29a711034.tar.gz
gdb-8c5e259235a4e4546910245b170de1e29a711034.tar.bz2
Usage of unitialized heap in tic4x_print_cond
PR 25319 * tic4x-dis.c (tic4x_print_cond): Init all of condtable.
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/tic4x-dis.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 9a15123..5187fb2 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-29 Alan Modra <amodra@gmail.com>
+
+ PR 25319
+ * tic4x-dis.c (tic4x_print_cond): Init all of condtable.
+
2019-12-27 Jan Beulich <jbeulich@suse.com>
* i386-dis.c (Jdqw): Define.
diff --git a/opcodes/tic4x-dis.c b/opcodes/tic4x-dis.c
index d9f95c9..01cfa1e 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 = xmalloc (sizeof (tic4x_cond_t *) * 32);
+ condtable = xcalloc (sizeof (tic4x_cond_t *), 32);
for (i = 0; i < tic4x_num_conds; i++)
condtable[tic4x_conds[i].cond] = (tic4x_cond_t *)(tic4x_conds + i);
}