From 45cb2ba1d52d81e20702b62610422fb09aaedeae Mon Sep 17 00:00:00 2001 From: Jamie Gennis Date: Mon, 6 Aug 2012 17:10:57 -0700 Subject: [PATCH] SurfaceTexture: fix an out of bounds array access Bug: 6879028 Change-Id: Ic3d35a9384c0a6dfa4000e7743a6f6859608b0bf --- libs/gui/SurfaceTexture.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp index 68b9feb07..a2aca8f0e 100644 --- a/libs/gui/SurfaceTexture.cpp +++ b/libs/gui/SurfaceTexture.cpp @@ -316,7 +316,7 @@ status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) { computeCurrentTransformMatrix(); } else { if (err < 0) { - ALOGE("updateTexImage failed on acquire %d", err); + ST_LOGE("updateTexImage failed on acquire %d", err); } // We always bind the texture even if we don't update its contents. glBindTexture(mTexTarget, mTexName); @@ -327,7 +327,7 @@ status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) { } void SurfaceTexture::setReleaseFence(int fenceFd) { - if (fenceFd == -1) + if (fenceFd == -1 || mCurrentTexture == BufferQueue::INVALID_BUFFER_SLOT) return; sp fence(new Fence(fenceFd)); if (!mEGLSlots[mCurrentTexture].mReleaseFence.get()) { @@ -337,7 +337,7 @@ void SurfaceTexture::setReleaseFence(int fenceFd) { String8("SurfaceTexture merged release"), mEGLSlots[mCurrentTexture].mReleaseFence, fence); if (!mergedFence.get()) { - ALOGE("failed to merge release fences"); + ST_LOGE("failed to merge release fences"); // synchronization is broken, the best we can do is hope fences // signal in order so the new fence will act like a union mEGLSlots[mCurrentTexture].mReleaseFence = fence;