summaryrefslogtreecommitdiffstats
path: root/source/slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2019-01-31 14:05:16 -0800
committerGitHub <noreply@github.com>2019-01-31 14:05:16 -0800
commitd877e221643dddd811855e290ded76609bfefb7d (patch)
tree9e5e1703e3b06e109bae6db136bbc2e816f96a2f /source/slang
parentf20c64c348393602ed2a9c873386345cc4b493e8 (diff)
parentbcb361db7c5a6f8baa9b2012b9ee9778421f1386 (diff)
Merge pull request #819 from csyonghe/crashfix
Fixes crashes at source error
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/check.cpp6
-rw-r--r--source/slang/slang.cpp3
2 files changed, 8 insertions, 1 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp
index 37005a21d..199e733ce 100644
--- a/source/slang/check.cpp
+++ b/source/slang/check.cpp
@@ -6603,11 +6603,15 @@ namespace Slang
candidate.subst = genSubst;
auto& checkedArgs = genSubst->args;
- int aa = 0;
+ uint32_t aa = 0;
for (auto memberRef : getMembers(genericDeclRef))
{
if (auto typeParamRef = memberRef.as<GenericTypeParamDecl>())
{
+ if (aa >= context.argCount)
+ {
+ return false;
+ }
auto arg = context.getArg(aa++);
TypeExp typeExp;
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 359848d65..e332ef588 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -912,6 +912,9 @@ RefPtr<ModuleDecl> CompileRequest::loadModule(
if( errorCountAfter != errorCountBefore )
{
mSink.diagnose(srcLoc, Diagnostics::errorInImportedModule);
+ }
+ if (errorCountAfter)
+ {
// Something went wrong during the parsing, so we should bail out.
return nullptr;
}