Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix use of uninitialized memory for Vector3 constants
  • Loading branch information
jkotas committed Aug 28, 2022
commit a8ed82ebef1f7b0b514b9f9548dc8b88856b2ccf
4 changes: 4 additions & 0 deletions src/coreclr/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2413,6 +2413,10 @@ void CodeGen::genSetRegToConst(regNumber targetReg, var_types targetType, GenTre
regNumber addrReg = tree->GetSingleTempReg();

simd16_t constValue = vecCon->gtSimd16Val;

if (tree->TypeGet() == TYP_SIMD12)
constValue.u32[3] = 0;

CORINFO_FIELD_HANDLE hnd = emit->emitSimd16Const(constValue);

emit->emitIns_R_C(INS_ldr, attr, targetReg, addrReg, hnd, 0);
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,10 @@ void CodeGen::genSetRegToConst(regNumber targetReg, var_types targetType, GenTre
case TYP_SIMD16:
{
simd16_t constValue = vecCon->gtSimd16Val;

if (tree->TypeGet() == TYP_SIMD12)
constValue.u32[3] = 0;

CORINFO_FIELD_HANDLE hnd = emit->emitSimd16Const(constValue);

emit->emitIns_R_C(ins_Load(targetType), attr, targetReg, hnd, 0);
Expand Down