Re: Usage of unitialized heap in tic4x_print_cond
authorAlan Modra <amodra@gmail.com>
Sun, 29 Dec 2019 22:49:25 +0000 (09:19 +1030)
committerAlan Modra <amodra@gmail.com>
Sun, 29 Dec 2019 23:05:29 +0000 (09:35 +1030)
PR 25319
* tic4x-dis.c (tic4x_print_cond): Correct order of xcalloc args.

opcodes/ChangeLog
opcodes/tic4x-dis.c

index bde9b9216665f87b45801b00559767da43301aa6..5021447c18b7dc909fe13c420afc3651d924bb62 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-30  Alan Modra  <amodra@gmail.com>
+
+       PR 25319
+       * tic4x-dis.c (tic4x_print_cond): Correct order of xcalloc args.
+
 2019-12-29  Alan Modra  <amodra@gmail.com>
 
        * sparc-dis.c (SEX): Don't use left and right shift to sign extend.
index 01cfa1e060ff8258a079c55b2aab00ee585f12ad..e058fdc9f8a3468284c5aece3d8db3b18ba9fcfa 100644 (file)
@@ -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);
     }