From aec7da740ab453ab9ecf9e12e8a97cefde3df26c Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Thu, 8 Dec 2011 14:35:12 -0800 Subject: [PATCH] Fix malformed program crashes. --- expr.cpp | 5 ++++- type.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/expr.cpp b/expr.cpp index a87a26cc..a3f2f52b 100644 --- a/expr.cpp +++ b/expr.cpp @@ -3050,7 +3050,10 @@ IndexExpr::GetValue(FunctionEmitContext *ctx) const { const SequentialType *st = dynamic_cast(baseExprType); - assert(st != NULL); + if (st == NULL) { + assert(m->errorCount > 0); + return NULL; + } lvalueType = PointerType::GetUniform(st->GetElementType()); lvalue = lAddVaryingOffsetsIfNeeded(ctx, lvalue, lvalueType); diff --git a/type.cpp b/type.cpp index 725320c5..84538d23 100644 --- a/type.cpp +++ b/type.cpp @@ -353,7 +353,10 @@ AtomicType::Mangle() const { std::string AtomicType::GetCDeclaration(const std::string &name) const { std::string ret; - assert(isUniform); + if (isUniform == false) { + assert(m->errorCount > 0); + return ret; + } if (isConst) ret += "const "; switch (basicType) {