Merge "Fix sanitizer in InputFlinger Reader/Dispatcher."
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index 4e5833a..3c1edd1 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -79,6 +79,10 @@
}
egl_display_t* egl_display_t::get(EGLDisplay dpy) {
+ if (uintptr_t(dpy) == 0) {
+ return nullptr;
+ }
+
uintptr_t index = uintptr_t(dpy)-1U;
if (index >= NUM_DISPLAYS || !sDisplay[index].isValid()) {
return nullptr;
diff --git a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp
index 37a530b..9c0af8b 100644
--- a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp
+++ b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp
@@ -166,12 +166,12 @@
size_t vpw, size_t vph, Rect sourceCrop, size_t hwh, bool yswap,
Transform::orientation_flags rotation) {
- size_t l = sourceCrop.left;
- size_t r = sourceCrop.right;
+ int32_t l = sourceCrop.left;
+ int32_t r = sourceCrop.right;
// In GL, (0, 0) is the bottom-left corner, so flip y coordinates
- size_t t = hwh - sourceCrop.top;
- size_t b = hwh - sourceCrop.bottom;
+ int32_t t = hwh - sourceCrop.top;
+ int32_t b = hwh - sourceCrop.bottom;
mat4 m;
if (yswap) {
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 0b5262d..624fda2 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2131,7 +2131,7 @@
// (ie: in drawing state but not in current state)
// also handle displays that changed
// (ie: displays that are in both lists)
- for (size_t i=0 ; i<dc ; i++) {
+ for (size_t i=0 ; i<dc ;) {
const ssize_t j = curr.indexOfKey(draw.keyAt(i));
if (j < 0) {
// in drawing state but not in current state
@@ -2166,7 +2166,7 @@
hw->disconnect(getHwComposer());
mDisplays.removeItem(display);
mDrawingState.displays.removeItemsAt(i);
- dc--; i--;
+ dc--;
// at this point we must loop to the next item
continue;
}
@@ -2188,6 +2188,7 @@
}
}
}
+ ++i;
}
// find displays that were added