am 4d2dbebf: fix for [1885684] E/SurfaceFlinger( 60): not enough memory for layer bitmap size=4294938624

Merge commit '4d2dbebf3d08209f751585d8cc367369e2f6e32f'

* commit '4d2dbebf3d08209f751585d8cc367369e2f6e32f':
  fix for [1885684] E/SurfaceFlinger( 60): not enough memory for layer bitmap size=4294938624
diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp
index 5ac1cfd..7a7574f 100644
--- a/libs/surfaceflinger/SurfaceFlinger.cpp
+++ b/libs/surfaceflinger/SurfaceFlinger.cpp
@@ -1212,6 +1212,13 @@
 {
     sp<LayerBaseClient> layer;
     sp<LayerBaseClient::Surface> surfaceHandle;
+
+    if (int32_t(w|h) < 0) {
+        LOGE("createSurface() failed, w or h is negative (w=%d, h=%d)",
+                int(w), int(h));
+        return surfaceHandle;
+    }
+    
     Mutex::Autolock _l(mStateLock);
     sp<Client> client = mClientsMap.valueFor(clientId);
     if (UNLIKELY(client == 0)) {