Check for misconfiguration of shader built-ins

Fail compiler initialization if the built-in resources are invalid.
This avoids creating zero-sized arrays out of built-ins into the
symbol table, which could later lead to asserts when these built-ins
were indexed by constants.

BUG=chromium:667468
TEST=angle_unittests

Change-Id: I9553c7c91ea355abb35b9cc6088ee14b40b0922b
Reviewed-on: https://chromium-review.googlesource.com/413037
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index 7b8f485..e08fc84 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -505,6 +505,15 @@
 
 bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
 {
+    if (resources.MaxDrawBuffers < 1)
+    {
+        return false;
+    }
+    if (resources.EXT_blend_func_extended && resources.MaxDualSourceDrawBuffers < 1)
+    {
+        return false;
+    }
+
     compileResources = resources;
     setResourceString();