Ensure uninitialized data is not accessed in normal operation

This commit is contained in:
Jack Andersen 2019-04-06 18:54:58 -10:00
parent 2ab5c1436b
commit 8b1b674a7d
6 changed files with 39 additions and 37 deletions

2
hecl/extern/athena vendored

@ -1 +1 @@
Subproject commit b40d3b17e5f20e102aa00845a9d548120eddea2d Subproject commit b9de85440046dba056a55c85e9952ce36ccf8156

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit c1d3d040bf5fcc3ec536d3b266bd5ca0ddded7d7 Subproject commit 0f330c1f057ec3c190d6278370f6e1628df435ed

View File

@ -72,49 +72,49 @@ public:
ShaderTag(std::string_view source, uint8_t c, uint8_t u, uint8_t w, uint8_t s, boo::Primitive pt, ShaderTag(std::string_view source, uint8_t c, uint8_t u, uint8_t w, uint8_t s, boo::Primitive pt,
Backend::ReflectionType reflectionType, bool depthTest, bool depthWrite, bool backfaceCulling, Backend::ReflectionType reflectionType, bool depthTest, bool depthWrite, bool backfaceCulling,
bool alphaTest) bool alphaTest)
: Hash(source) : Hash(source) {
, m_colorCount(c) m_colorCount = c;
, m_uvCount(u) m_uvCount = u;
, m_weightCount(w) m_weightCount = w;
, m_skinSlotCount(s) m_skinSlotCount = s;
, m_primitiveType(uint8_t(pt)) m_primitiveType = uint8_t(pt);
, m_reflectionType(uint8_t(reflectionType)) m_reflectionType = uint8_t(reflectionType);
, m_depthTest(depthTest) m_depthTest = depthTest;
, m_depthWrite(depthWrite) m_depthWrite = depthWrite;
, m_backfaceCulling(backfaceCulling) m_backfaceCulling = backfaceCulling;
, m_alphaTest(alphaTest) { m_alphaTest = alphaTest;
hash ^= m_meta; hash ^= m_meta;
} }
ShaderTag(const hecl::Frontend::IR& ir, uint8_t c, uint8_t u, uint8_t w, uint8_t s, boo::Primitive pt, ShaderTag(const hecl::Frontend::IR& ir, uint8_t c, uint8_t u, uint8_t w, uint8_t s, boo::Primitive pt,
Backend::ReflectionType reflectionType, bool depthTest, bool depthWrite, bool backfaceCulling, Backend::ReflectionType reflectionType, bool depthTest, bool depthWrite, bool backfaceCulling,
bool alphaTest) bool alphaTest)
: Hash(ir.m_hash) : Hash(ir.m_hash) {
, m_colorCount(c) m_colorCount = c;
, m_uvCount(u) m_uvCount = u;
, m_weightCount(w) m_weightCount = w;
, m_skinSlotCount(s) m_skinSlotCount = s;
, m_primitiveType(uint8_t(pt)) m_primitiveType = uint8_t(pt);
, m_reflectionType(uint8_t(reflectionType)) m_reflectionType = uint8_t(reflectionType);
, m_depthTest(depthTest) m_depthTest = depthTest;
, m_depthWrite(depthWrite) m_depthWrite = depthWrite;
, m_backfaceCulling(backfaceCulling) m_backfaceCulling = backfaceCulling;
, m_alphaTest(alphaTest) { m_alphaTest = alphaTest;
hash ^= m_meta; hash ^= m_meta;
} }
ShaderTag(uint64_t hashin, uint8_t c, uint8_t u, uint8_t w, uint8_t s, boo::Primitive pt, ShaderTag(uint64_t hashin, uint8_t c, uint8_t u, uint8_t w, uint8_t s, boo::Primitive pt,
Backend::ReflectionType reflectionType, bool depthTest, bool depthWrite, bool backfaceCulling, Backend::ReflectionType reflectionType, bool depthTest, bool depthWrite, bool backfaceCulling,
bool alphaTest) bool alphaTest)
: Hash(hashin) : Hash(hashin) {
, m_colorCount(c) m_colorCount = c;
, m_uvCount(u) m_uvCount = u;
, m_weightCount(w) m_weightCount = w;
, m_skinSlotCount(s) m_skinSlotCount = s;
, m_primitiveType(uint8_t(pt)) m_primitiveType = uint8_t(pt);
, m_reflectionType(uint8_t(reflectionType)) m_reflectionType = uint8_t(reflectionType);
, m_depthTest(depthTest) m_depthTest = depthTest;
, m_depthWrite(depthWrite) m_depthWrite = depthWrite;
, m_backfaceCulling(backfaceCulling) m_backfaceCulling = backfaceCulling;
, m_alphaTest(alphaTest) { m_alphaTest = alphaTest;
hash ^= m_meta; hash ^= m_meta;
} }
ShaderTag(uint64_t comphashin, uint64_t meta) : Hash(comphashin), m_meta(meta) {} ShaderTag(uint64_t comphashin, uint64_t meta) : Hash(comphashin), m_meta(meta) {}

View File

@ -75,7 +75,7 @@ struct Evaluation {
}; };
} // namespace PipelineStage } // namespace PipelineStage
#ifdef __APPLE__ #ifdef _LIBCPP_VERSION
using StageBinaryData = std::shared_ptr<uint8_t>; using StageBinaryData = std::shared_ptr<uint8_t>;
static inline StageBinaryData MakeStageBinaryData(size_t sz) { static inline StageBinaryData MakeStageBinaryData(size_t sz) {
return StageBinaryData(new uint8_t[sz], std::default_delete<uint8_t[]>{}); return StageBinaryData(new uint8_t[sz], std::default_delete<uint8_t[]>{});

View File

@ -51,7 +51,7 @@ private:
boo::IWindow* m_window = nullptr; boo::IWindow* m_window = nullptr;
std::unordered_map<std::string, SConsoleCommand> m_commands; std::unordered_map<std::string, SConsoleCommand> m_commands;
std::vector<std::pair<std::string, Level>> m_log; std::vector<std::pair<std::string, Level>> m_log;
int m_logOffset; int m_logOffset = 0;
std::string m_commandString; std::string m_commandString;
std::vector<std::string> m_commandHistory; std::vector<std::string> m_commandHistory;
int m_cursorPosition = -1; int m_cursorPosition = -1;

View File

@ -224,12 +224,14 @@ void Connection::_blenderDied() {
static std::atomic_bool BlenderFirstInit(false); static std::atomic_bool BlenderFirstInit(false);
#if _WIN32
static bool RegFileExists(const hecl::SystemChar* path) { static bool RegFileExists(const hecl::SystemChar* path) {
if (!path) if (!path)
return false; return false;
hecl::Sstat theStat; hecl::Sstat theStat;
return !hecl::Stat(path, &theStat) && S_ISREG(theStat.st_mode); return !hecl::Stat(path, &theStat) && S_ISREG(theStat.st_mode);
} }
#endif
Connection::Connection(int verbosityLevel) { Connection::Connection(int verbosityLevel) {
#if !WINDOWS_STORE #if !WINDOWS_STORE