generate INVALID_VALUE if calling Uniform1i/v on sampler > MAX_IMAGE_TEXTURE_UNITS

TEST=unit tests
BUG=125900


Review URL: http://codereview.chromium.org/10314004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134977 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 18c799d..e683128 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -4615,7 +4615,11 @@
       fake_location, "glUniform1iv", &real_location, &type, &count)) {
     return;
   }
-  current_program_->SetSamplers(fake_location, 1, &v0);
+  if (!current_program_->SetSamplers(
+      group_->max_texture_units(), fake_location, 1, &v0)) {
+    SetGLError(GL_INVALID_VALUE, "glUniform1i: texture unit out of range");
+    return;
+  }
   glUniform1i(real_location, v0);
 }
 
@@ -4629,7 +4633,11 @@
   }
   if (type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE ||
       type == GL_SAMPLER_EXTERNAL_OES) {
-    current_program_->SetSamplers(fake_location, count, value);
+    if (!current_program_->SetSamplers(
+          group_->max_texture_units(), fake_location, count, value)) {
+      SetGLError(GL_INVALID_VALUE, "glUniform1iv: texture unit out of range");
+      return;
+    }
   }
   glUniform1iv(real_location, count, value);
 }