Validate glClearBuffer*v function |buffer| param on the client side

Otherwise we could read out-of-bounds even if an invalid |buffer| is passed
in and in theory we should not read the buffer at all.

BUG=908749
TEST=gl_tests in ASAN build
R=piman@chromium.org

Change-Id: I94b69b56ce3358ff9bfc0e21f0618aec4371d1ec
Reviewed-on: https://chromium-review.googlesource.com/c/1354571
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612023}
size_t GLES2Util::GetGLTypeSizeForBuffers(uint32_t type) {
  switch (type) {
    case GL_BYTE:
      return sizeof(GLbyte);  // NOLINT
    case GL_UNSIGNED_BYTE:
      return sizeof(GLubyte);  // NOLINT
    case GL_SHORT:
      return sizeof(GLshort);  // NOLINT
    case GL_UNSIGNED_SHORT:
      return sizeof(GLushort);  // NOLINT
    case GL_INT:
      return sizeof(GLint);  // NOLINT
    case GL_UNSIGNED_INT:
      return sizeof(GLuint);  // NOLINT
    case GL_FLOAT:
      return sizeof(GLfloat);  // NOLINT
    case GL_FIXED:
      return sizeof(GLfixed);  // NOLINT
    case GL_HALF_FLOAT:
      return sizeof(GLushort);  // NOLINT
    case GL_INT_2_10_10_10_REV:
      return sizeof(GLint);  // NOLINT
    case GL_UNSIGNED_INT_2_10_10_10_REV:
      return sizeof(GLuint);  // NOLINT
    default:
      return 0;
  }
}

size_t GLES2Util::GetGLTypeSizeForBuffers(uint32_t type) {
  switch (type) {
    case GL_BYTE:
      return sizeof(GLbyte);  // NOLINT
    case GL_UNSIGNED_BYTE:
      return sizeof(GLubyte);  // NOLINT
    case GL_SHORT:
      return sizeof(GLshort);  // NOLINT
    case GL_UNSIGNED_SHORT:
      return sizeof(GLushort);  // NOLINT
    case GL_INT:
      return sizeof(GLint);  // NOLINT
    case GL_UNSIGNED_INT:
      return sizeof(GLuint);  // NOLINT
    case GL_FLOAT:
      return sizeof(GLfloat);  // NOLINT
    case GL_FIXED:
      return sizeof(GLfixed);  // NOLINT
    case GL_HALF_FLOAT:
      return sizeof(GLushort);  // NOLINT
    case GL_INT_2_10_10_10_REV:
      return sizeof(GLint);  // NOLINT
    case GL_UNSIGNED_INT_2_10_10_10_REV:
      return sizeof(GLuint);  // NOLINT
    default:
      return 0;
  }
}
