Fix an illegal memory access when attempting to disassemble a corrupt TIC30 binary.
PR 27840 * tic30-dis.c (print_insn_tic30): Prevent attempts to read beyond the end of the code buffer.
This commit is contained in:
parent
22604fe675
commit
a680affc63
2 changed files with 9 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2021-05-11 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR 27840
|
||||||
|
* tic30-dis.c (print_insn_tic30): Prevent attempts to read beyond
|
||||||
|
the end of the code buffer.
|
||||||
|
|
||||||
2021-05-06 Stafford Horne <shorne@gmail.com>
|
2021-05-06 Stafford Horne <shorne@gmail.com>
|
||||||
|
|
||||||
PR 21464
|
PR 21464
|
||||||
|
|
|
@ -695,6 +695,9 @@ print_insn_tic30 (bfd_vma pc, disassemble_info *info)
|
||||||
struct instruction insn = { 0, NULL, NULL };
|
struct instruction insn = { 0, NULL, NULL };
|
||||||
bfd_vma bufaddr = pc - info->buffer_vma;
|
bfd_vma bufaddr = pc - info->buffer_vma;
|
||||||
|
|
||||||
|
if (bufaddr + 3 >= info->buffer_length)
|
||||||
|
return -1;
|
||||||
|
|
||||||
/* Obtain the current instruction word from the buffer. */
|
/* Obtain the current instruction word from the buffer. */
|
||||||
insn_word = (((unsigned) *(info->buffer + bufaddr) << 24)
|
insn_word = (((unsigned) *(info->buffer + bufaddr) << 24)
|
||||||
| (*(info->buffer + bufaddr + 1) << 16)
|
| (*(info->buffer + bufaddr + 1) << 16)
|
||||||
|
|
Loading…
Add table
Reference in a new issue