From be31f447984b3ab4ac011353b6b53216b4335e04 Mon Sep 17 00:00:00 2001 From: Dan Stoza Date: Wed, 11 Jun 2014 11:20:54 -0700 Subject: [PATCH] SurfaceFlinger: Fix rect out-of-bounds checks Rects' right and bottom edges are treated as exclusive, so when checking against maximum width and height, we should use > instead of >=. Change-Id: Ifcdf6813c13fcab1a55f16c21064e765e93d49f0 --- services/surfaceflinger/SurfaceFlinger.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 7152f9364..cd5fe6bd3 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2901,14 +2901,14 @@ void SurfaceFlinger::renderScreenImplLocked( if (sourceCrop.left < 0) { ALOGE("Invalid crop rect: l = %d (< 0)", sourceCrop.left); } - if (sourceCrop.right >= hw_w) { - ALOGE("Invalid crop rect: r = %d (>= %d)", sourceCrop.right, hw_w); + if (sourceCrop.right > hw_w) { + ALOGE("Invalid crop rect: r = %d (> %d)", sourceCrop.right, hw_w); } if (sourceCrop.top < 0) { ALOGE("Invalid crop rect: t = %d (< 0)", sourceCrop.top); } - if (sourceCrop.bottom >= hw_h) { - ALOGE("Invalid crop rect: b = %d (>= %d)", sourceCrop.bottom, hw_h); + if (sourceCrop.bottom > hw_h) { + ALOGE("Invalid crop rect: b = %d (> %d)", sourceCrop.bottom, hw_h); } // make sure to clear all GL error flags