Commit 41827c38 by Alexis Hetu Committed by Alexis Hétu

Fixed infinite loop crash

Writing for(;;) in a shader was crashing because a NULL condition was dereferenced. Added the NULL pointer check to fix the crash. Change-Id: I2be7a4594029c928ff83221f65503636bc28f4a9 Reviewed-on: https://swiftshader-review.googlesource.com/3553Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 146dd310
...@@ -1275,7 +1275,10 @@ namespace glsl ...@@ -1275,7 +1275,10 @@ namespace glsl
} }
else else
{ {
if(condition)
{
condition->traverse(this); condition->traverse(this);
}
emit(sw::Shader::OPCODE_WHILE, 0, condition); emit(sw::Shader::OPCODE_WHILE, 0, condition);
...@@ -1291,7 +1294,10 @@ namespace glsl ...@@ -1291,7 +1294,10 @@ namespace glsl
expression->traverse(this); expression->traverse(this);
} }
if(condition)
{
condition->traverse(this); condition->traverse(this);
}
emit(sw::Shader::OPCODE_ENDWHILE); emit(sw::Shader::OPCODE_ENDWHILE);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment