translator: Fix validation sometimes modifying builtins.

When validating some shaders with out-of-bounds array indexes,
we would write the sanitized index into the global symbol table.
We would then overwrite a wrong value for the builtin. This
fixes the WebGL test extensions/webgl-draw-buffers-max-draw-buffers.

Also mark const on as many uses ConstantUnion as we can.

BUG=angleproject:993

Change-Id: I110efaf1b7b0158b08b704277e3bc2472437902c
Reviewed-on: https://chromium-review.googlesource.com/268962
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
diff --git a/src/compiler/translator/parseConst.cpp b/src/compiler/translator/parseConst.cpp
index cb9dfa8..2ace877 100644
--- a/src/compiler/translator/parseConst.cpp
+++ b/src/compiler/translator/parseConst.cpp
@@ -177,7 +177,7 @@
     if (!mSingleConstantParam)
     {
         size_t objectSize = node->getType().getObjectSize();
-        TConstantUnion *rightUnionArray = node->getUnionArrayPointer();
+        const TConstantUnion *rightUnionArray = node->getUnionArrayPointer();
         for (size_t i=0; i < objectSize; i++)
         {
             if (mIndex >= instanceSize)
@@ -189,7 +189,7 @@
     else
     {
         size_t totalSize = mIndex + mSize;
-        TConstantUnion *rightUnionArray = node->getUnionArrayPointer();
+        const TConstantUnion *rightUnionArray = node->getUnionArrayPointer();
         if (!mIsDiagonalMatrixInit)
         {
             int count = 0;