summaryrefslogtreecommitdiff
path: root/assemble.c
diff options
context:
space:
mode:
authorJin Kyu Song <jin.kyu.song@intel.com>2013-09-20 20:36:19 -0700
committerCyrill Gorcunov <gorcunov@gmail.com>2013-09-21 12:26:36 +0400
commitdb358a2993be0e0aa3864ed3290105dd4a544c35 (patch)
tree9c1abceb5da8e11e4c48975f128245221789abd5 /assemble.c
parenteb595942b2c9421548d110e511d12823f38cffbf (diff)
downloadnasm-db358a2993be0e0aa3864ed3290105dd4a544c35.tar.gz
nasm-db358a2993be0e0aa3864ed3290105dd4a544c35.tar.bz2
nasm-db358a2993be0e0aa3864ed3290105dd4a544c35.zip
AVX-512: Fix bugs related to uninitialized variables
Initialized disp8 to avoid a case that disp8 encoded instead of the actual offset value. Added a checking routine for basereg value before using it as an index of array. Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'assemble.c')
-rw-r--r--assemble.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/assemble.c b/assemble.c
index c0e316a..a38e56e 100644
--- a/assemble.c
+++ b/assemble.c
@@ -2147,7 +2147,8 @@ static enum match_result matches(const struct itemplate *itemp,
*/
opsizemissing = true;
}
- } else if (nasm_regvals[instruction->oprs[i].basereg] >= 16 &&
+ } else if (is_register(instruction->oprs[i].basereg) &&
+ nasm_regvals[instruction->oprs[i].basereg] >= 16 &&
!(itemp->flags & IF_AVX512)) {
return MERR_ENCMISMATCH;
}
@@ -2313,6 +2314,7 @@ static enum ea_type process_ea(operand *input, ea *output, int bits,
output->type = EA_SCALAR;
output->rip = false;
+ output->disp8 = 0;
/* REX flags for the rfield operand */
output->rex |= rexflags(rfield, rflags, REX_R | REX_P | REX_W | REX_H);