From e49d7ec36132f33b7c9e2c044ab9dd3585aa3747 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Fri, 7 Sep 2012 18:42:38 -0700 Subject: Fix memory corruption in LayerRenderer::copyLayer The pixel store pack alignment was not set for the source texture, causing a write to occur outside of the destination bitmap's bounds. Change-Id: Iaa5767acf7b5943fbc2765c3810a142f06b1a796 --- libs/hwui/LayerRenderer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libs/hwui/LayerRenderer.cpp') diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp index f81640b22b37..5a8f2b724e8a 100644 --- a/libs/hwui/LayerRenderer.cpp +++ b/libs/hwui/LayerRenderer.cpp @@ -400,6 +400,8 @@ bool LayerRenderer::copyLayer(Layer* layer, SkBitmap* bitmap) { caches.activeTexture(0); glBindTexture(GL_TEXTURE_2D, texture); + glPixelStorei(GL_PACK_ALIGNMENT, bitmap->bytesPerPixel()); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); -- cgit v1.2.3-59-g8ed1b