Merge change 6742
* changes:
fix [1969200] Uninitialized double passed to Math.sqrt()
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)) {
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index 0fc934f..6f6656a 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -1494,7 +1494,7 @@
// default value
if (binarySearch<config_pair_t>(
(config_pair_t const*)attrib_list,
- 0, numAttributes,
+ 0, numAttributes-1,
config_defaults[j].key) < 0)
{
for (int i=0 ; i<numConfigs ; i++) {
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 004b74a..c2003dd 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -731,7 +731,7 @@
EGLint patch_index = -1;
GLint attr;
size_t size = 0;
- while ((attr=attrib_list[size])) {
+ while ((attr=attrib_list[size]) != EGL_NONE) {
if (attr == EGL_CONFIG_ID)
patch_index = size;
size += 2;