Guard against copying from a zero-sized 3D image.
Bug chromium:825545
Change-Id: I37d6192bf65115938943f45d43e153196a7d569a
Reviewed-on: https://swiftshader-review.googlesource.com/18128
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/OpenGL/libGLESv2/Device.cpp b/src/OpenGL/libGLESv2/Device.cpp
index 6fcfba8..81238df 100644
--- a/src/OpenGL/libGLESv2/Device.cpp
+++ b/src/OpenGL/libGLESv2/Device.cpp
@@ -649,6 +649,12 @@
int dHeight = dest->getHeight();
int dDepth = dest->getDepth();
+ if((sWidth == 0) || (sHeight == 0) || (sDepth == 0) ||
+ (dWidth == 0) || (dHeight == 0) || (dDepth == 0))
+ {
+ return true; // no work to do
+ }
+
bool scaling = (sWidth != dWidth) || (sHeight != dHeight) || (sDepth != dDepth);
bool equalFormats = source->getInternalFormat() == dest->getInternalFormat();
bool alpha0xFF = false;