mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-11 08:15:40 +00:00
target/arm: Move computation of index in handle_simd_dupe
Coverity reports a BAD_SHIFT with ctz32(imm5), with imm5 == 0. This is an invalid encoding, but we diagnose that just below by rejecting size > 3. Avoid the warning by sinking the computation of index below the check. Backports commit 550a04893c2bd4442211b353680b9a6408d94dba from qemu
This commit is contained in:
parent
fd4ce2cba0
commit
c9ee9a2729
|
@ -7683,7 +7683,7 @@ static void handle_simd_dupe(DisasContext *s, int is_q, int rd, int rn,
|
|||
{
|
||||
TCGContext *tcg_ctx = s->uc->tcg_ctx;
|
||||
int size = ctz32(imm5);
|
||||
int index = imm5 >> (size + 1);
|
||||
int index;
|
||||
|
||||
if (size > 3 || (size == 3 && !is_q)) {
|
||||
unallocated_encoding(s);
|
||||
|
@ -7694,6 +7694,7 @@ static void handle_simd_dupe(DisasContext *s, int is_q, int rd, int rn,
|
|||
return;
|
||||
}
|
||||
|
||||
index = imm5 >> (size + 1);
|
||||
tcg_gen_gvec_dup_mem(tcg_ctx, size, vec_full_reg_offset(s, rd),
|
||||
vec_reg_offset(s, rn, index, size),
|
||||
is_q ? 16 : 8, vec_full_reg_size(s));
|
||||
|
|
Loading…
Reference in a new issue