OSDN Git Service

Loop count crash fixed
authorAlexis Hetu <sugoi@google.com>
Wed, 11 May 2016 14:56:43 +0000 (10:56 -0400)
committerAlexis Hétu <sugoi@google.com>
Fri, 20 May 2016 19:15:02 +0000 (19:15 +0000)
The loopCount function was expecting the left side of a binary op
to always be a symbol, which isn't necessarily the case, so a null
pointer check was added to prevent the crash.

Change-Id: I1fe6626bf52ecbb05664d1d2fa18f7ed830a7ee6
Reviewed-on: https://swiftshader-review.googlesource.com/5344
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
src/OpenGL/compiler/OutputASM.cpp

index 8cf572b..00af34a 100644 (file)
@@ -3528,8 +3528,9 @@ namespace glsl
                if(index && node->getCondition())
                {
                        TIntermBinary *test = node->getCondition()->getAsBinaryNode();
+                       TIntermSymbol *left = test ? test->getLeft()->getAsSymbolNode() : nullptr;
 
-                       if(test && test->getLeft()->getAsSymbolNode()->getId() == index->getId())
+                       if(left && (left->getId() == index->getId()))
                        {
                                TIntermConstantUnion *constant = test->getRight()->getAsConstantUnion();