compiler/libec: Fixed null pointer crash
authorJerome St-Louis <jerome@ecere.com>
Mon, 9 Jun 2014 07:55:07 +0000 (03:55 -0400)
committerJerome St-Louis <jerome@ecere.com>
Mon, 9 Jun 2014 07:56:07 +0000 (03:56 -0400)
compiler/bootstrap/libec/bootstrap/pass2.c
compiler/libec/src/pass2.ec

index 2ef3399..db78ef1 100644 (file)
@@ -3846,7 +3846,7 @@ if(exp->needTemplateCast != 2 && (exp->needTemplateCast == 1 || (exp->expType &&
 struct Expression * nbExp = GetNonBracketsExp(exp);
 struct Expression * inner = GetInnerExp(nbExp);
 
-if((!exp->expType || exp->expType->kind != 20 || nbExp->type != 11) && !((unsigned int)((exp->usage & 0x40) >> 6)) && (!exp->destType || (!exp->destType->truth && (exp->destType->kind != 20 || (exp->destType->__anon1.templateParameter && (exp->destType->__anon1.templateParameter->dataTypeString || exp->destType->__anon1.templateParameter->__anon1.dataType))))) && (((unsigned int)((exp->usage & 0x80) >> 7)) || ((unsigned int)((exp->usage & 0x1) >> 0)) || ((unsigned int)((exp->usage & 0x4) >> 2))) && (!exp->destType || (!exp->destType->passAsTemplate && (exp->expType->kind != 13 || exp->destType->kind == 13) && (exp->destType->kind != 13 || exp->expType->kind == 13))) && !inner->needCast && inner->type != 4)
+if((!exp->expType || exp->expType->kind != 20 || nbExp->type != 11) && !((unsigned int)((exp->usage & 0x40) >> 6)) && (!exp->destType || (!exp->destType->truth && (exp->destType->kind != 20 || (exp->destType->__anon1.templateParameter && (exp->destType->__anon1.templateParameter->dataTypeString || exp->destType->__anon1.templateParameter->__anon1.dataType))))) && (((unsigned int)((exp->usage & 0x80) >> 7)) || ((unsigned int)((exp->usage & 0x1) >> 0)) || ((unsigned int)((exp->usage & 0x4) >> 2))) && (!exp->destType || (!exp->destType->passAsTemplate && exp->expType && (exp->expType->kind != 13 || exp->destType->kind == 13) && (exp->destType->kind != 13 || exp->expType->kind == 13))) && !inner->needCast && inner->type != 4)
 {
 struct Expression * e = CopyExpContents(exp);
 struct Declarator * decl;
index d1f5cd7..681a21a 100644 (file)
@@ -3105,7 +3105,7 @@ static void ProcessExpression(Expression exp)
       if((!exp.expType || exp.expType.kind != templateType || nbExp.type != castExp) && !exp.usage.usageRef &&
          (!exp.destType || (!exp.destType.truth && (exp.destType.kind != templateType || (exp.destType.templateParameter && (exp.destType.templateParameter.dataTypeString || exp.destType.templateParameter.dataType))))) &&
          (exp.usage.usageDelete || exp.usage.usageGet || exp.usage.usageArg) &&
-         (!exp.destType || (!exp.destType.passAsTemplate && (exp.expType.kind != pointerType || exp.destType.kind == pointerType) && (exp.destType.kind != pointerType || exp.expType.kind == pointerType))) &&
+         (!exp.destType || (!exp.destType.passAsTemplate && exp.expType && (exp.expType.kind != pointerType || exp.destType.kind == pointerType) && (exp.destType.kind != pointerType || exp.expType.kind == pointerType))) &&
          !inner.needCast && inner.type != opExp)
       {
          Expression e = CopyExpContents(exp);