Fix malformed program crashes.

This commit is contained in:
Matt Pharr
2011-12-08 14:35:12 -08:00
parent a79bc75b72
commit aec7da740a
2 changed files with 8 additions and 2 deletions

View File

@@ -3050,7 +3050,10 @@ IndexExpr::GetValue(FunctionEmitContext *ctx) const {
const SequentialType *st =
dynamic_cast<const SequentialType *>(baseExprType);
assert(st != NULL);
if (st == NULL) {
assert(m->errorCount > 0);
return NULL;
}
lvalueType = PointerType::GetUniform(st->GetElementType());
lvalue = lAddVaryingOffsetsIfNeeded(ctx, lvalue, lvalueType);

View File

@@ -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) {