Disallow null pixel data for TexSubImage that have non-zero size.

BUG=angleproject:2055

Change-Id: I4c338691776c6d807333c169ed876d686188a97c
Reviewed-on: https://chromium-review.googlesource.com/735786
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES3.cpp b/src/libANGLE/validationES3.cpp
index 1b1387a..9e0433a 100644
--- a/src/libANGLE/validationES3.cpp
+++ b/src/libANGLE/validationES3.cpp
@@ -428,6 +428,13 @@
             context->handleError(InvalidValue());
             return false;
         }
+
+        if (width > 0 && height > 0 && depth > 0 && pixels == nullptr &&
+            context->getGLState().getTargetBuffer(GL_PIXEL_UNPACK_BUFFER) == nullptr)
+        {
+            ANGLE_VALIDATION_ERR(context, InvalidValue(), PixelDataNull);
+            return false;
+        }
     }
 
     GLenum sizeCheckFormat = isSubImage ? format : internalformat;