summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-09-07 09:50:50 -0700
committerTim Foley <tfoley@nvidia.com>2017-09-07 09:50:50 -0700
commitced92a047e510480cff15be1a1cd102abffa3f82 (patch)
tree470c20f7948693f39b7603645ad9d09fb693c459 /source
parentad3539574f52634c51523cfec1747e7565ad8876 (diff)
Fixup: fix uninitialized memory bug
This is a bug that already existed in the IR code, but wasn't getting triggered on existing test cases, and only seems to affect the 64-bit target right now. The "key" value being constructed to cache and re-use constants during IR generation wasn't actually being fully initialized, and so garbage values in it could cause the lookup of an existing value to fail where it should succeed.
Diffstat (limited to 'source')
-rw-r--r--source/slang/ir.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp
index e3647a47b..eadcd34d0 100644
--- a/source/slang/ir.cpp
+++ b/source/slang/ir.cpp
@@ -569,6 +569,7 @@ namespace Slang
IRParentInst* parent = builder->shared->module;
IRConstant keyInst;
+ memset(&keyInst, 0, sizeof(keyInst));
keyInst.op = op;
keyInst.type.usedValue = type;
memcpy(&keyInst.u, value, valueSize);