diff options
author | Ted Bonkenburg <tedbo@google.com> | 2011-08-09 22:38:41 -0700 |
---|---|---|
committer | Ted Bonkenburg <tedbo@google.com> | 2011-08-09 22:45:38 -0700 |
commit | 3f945fa5ef3f9d8f1d0787118a956fa631451163 (patch) | |
tree | 1b67542661cdb3c3b86f7dd88a4f3ea517179543 /libs | |
parent | c993acbce63b60385b01cf1b95a4799ec308339b (diff) | |
download | frameworks_base-3f945fa5ef3f9d8f1d0787118a956fa631451163.zip frameworks_base-3f945fa5ef3f9d8f1d0787118a956fa631451163.tar.gz frameworks_base-3f945fa5ef3f9d8f1d0787118a956fa631451163.tar.bz2 |
Read leftover parcel data when a parceled Surface is found in the cache.
This fixes an issue where the Surface readFromParcel code was leaving
unread parcel data in the case where the Surface was re-used from the
sCachedSurfaces cache. On a cache miss the code is creating a new
Surface from the remainder of the parcel data. On a hit that data was
being left unread, so anything that parcels a Surface followed by
additional arguments may end up reading the wrong values.
Change-Id: I25365159d945c125bd1fcc9f17e39a4f00aece55
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gui/Surface.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index ccf98e5..2c70251 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -277,6 +277,11 @@ sp<Surface> Surface::readFromParcel(const Parcel& data) { if (surface == 0) { surface = new Surface(data, binder); sCachedSurfaces.add(binder, surface); + } else { + // The Surface was found in the cache, but we still should clear any + // remaining data from the parcel. + data.readStrongBinder(); // ISurfaceTexture + data.readInt32(); // identity } if (surface->mSurface == NULL && surface->getISurfaceTexture() == NULL) { surface = 0; |