diff options
author | Jan Beulich <jbeulich@suse.com> | 2022-06-13 09:51:38 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2022-06-13 09:51:38 +0200 |
commit | 384e201e5aec29412a18b8386aa0a1ab6743e6cb (patch) | |
tree | 0aa773e795d576cb9bd4745859066ffaa17248bd /gdb/testsuite/lib/gdb-python.exp | |
parent | 536595b71230d1eeff3814bbb23b2a4de3850da4 (diff) | |
download | gdb-384e201e5aec29412a18b8386aa0a1ab6743e6cb.zip gdb-384e201e5aec29412a18b8386aa0a1ab6743e6cb.tar.gz gdb-384e201e5aec29412a18b8386aa0a1ab6743e6cb.tar.bz2 |
x86: properly initialize struct instr_info instance(s)
Commit 39fb369834a3 ("opcodes: Make i386-dis.c thread-safe") introduced
a lot of uninitialized data. Alan has in particular observed ubsan
taking issue with the loop inverting the order of operands, where
op_riprel[] - an array of bool - can hold values other than 0 or 1.
Move instantiation of struct instr_info into print_insn() (thus having
just a single central point), and make use of C99 dedicated initializers
to fill fields right in the initializer where possible. This way all
fields not explicitly initialized will be zero-filled, which in turn
allows dropping of some other explicit initialization later in the
function or in ckprefix(). Additionally this removes a lot of
indirection, as all "ins->info" uses can simply become "info".
Make one further arrangement though, to limit the amount of data needing
(zero)initializing on every invocation: Convert the op_out structure
member to just an array of pointers, with the actual arrays living
inside print_insn() (and, as befoe, having just their 1st char filled
with nul).
While there, instead of adjusting print_insn()'s forward declaration,
arrange for no such declaration to be needed in the first place.
Diffstat (limited to 'gdb/testsuite/lib/gdb-python.exp')
0 files changed, 0 insertions, 0 deletions