diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2022-08-16 08:25:49 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2022-08-16 09:36:58 -0700 |
commit | 9096fc28c62741bfb7962eb5dfdee28a7b1d1345 (patch) | |
tree | aa6f31a3ebb12f483a7ba6398d3420dfd48eaa4e /opcodes | |
parent | cb3dee0e0e584ea91b5c0c158fb2482efa6c41be (diff) | |
download | fsf-binutils-gdb-9096fc28c62741bfb7962eb5dfdee28a7b1d1345.zip fsf-binutils-gdb-9096fc28c62741bfb7962eb5dfdee28a7b1d1345.tar.gz fsf-binutils-gdb-9096fc28c62741bfb7962eb5dfdee28a7b1d1345.tar.bz2 |
i386: Add MAX_OPERAND_BUFFER_SIZE
When displaying operands, invalid opcodes may overflow operand buffer
due to additional styling characters. Each style is encoded with 3
bytes. Define MAX_OPERAND_BUFFER_SIZE for operand buffer size and
increase it from 100 bytes to 128 bytes to accommodate 9 sets of styles
in an operand.
gas/
PR binutils/29483
* testsuite/gas/i386/i386.exp: Run pr29483.
* testsuite/gas/i386/pr29483.d: New file.
* testsuite/gas/i386/pr29483.s: Likewise.
opcodes/
PR binutils/29483
* i386-dis.c (MAX_OPERAND_BUFFER_SIZE): New.
(obuf): Replace 100 with MAX_OPERAND_BUFFER_SIZE.
(staging_area): Likewise.
(op_out): Likewise.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/i386-dis.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 1761df5..c1166a4 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -119,6 +119,9 @@ static void DistinctDest_Fixup (instr_info *, int, int); buffers. See oappend_insert_style for more details. */ #define STYLE_MARKER_CHAR '\002' +/* The maximum operand buffer size. */ +#define MAX_OPERAND_BUFFER_SIZE 128 + struct dis_private { /* Points to first byte not fetched. */ bfd_byte *max_fetched; @@ -165,7 +168,7 @@ struct instr_info current instruction. */ int evex_used; - char obuf[100]; + char obuf[MAX_OPERAND_BUFFER_SIZE]; char *obufp; char *mnemonicendp; unsigned char *start_codep; @@ -9275,7 +9278,7 @@ i386_dis_printf (instr_info *ins, enum disassembler_style style, va_list ap; enum disassembler_style curr_style = style; char *start, *curr; - char staging_area[100]; + char staging_area[MAX_OPERAND_BUFFER_SIZE]; int res; va_start (ap, fmt); @@ -9377,7 +9380,7 @@ print_insn (bfd_vma pc, disassemble_info *info, int intel_syntax) .last_seg_prefix = -1, .fwait_prefix = -1, }; - char op_out[MAX_OPERANDS][100]; + char op_out[MAX_OPERANDS][MAX_OPERAND_BUFFER_SIZE]; priv.orig_sizeflag = AFLAG | DFLAG; if ((info->mach & bfd_mach_i386_i386) != 0) |