Check for invalid (negative) string pool pos.

Parcel implementation would crash the system server otherwise.
Any exception is OK as it'll cause the cache to be invalidated.
Crash is not OK.

Bug: 194632313
Fixes: 194632313
Test: atest PackageParserCacheHelperTest
Change-Id: I58a4496b4646e172e6c3aee9ea17854a7ef55eaa
This commit is contained in:
Alex Buynytskyy
2021-07-26 10:04:37 -07:00
parent 88a506aad4
commit b2a831ac3c

View File

@@ -56,6 +56,9 @@ public class PackageParserCacheHelper {
mStrings.clear();
final int poolPosition = mParcel.readInt();
if (poolPosition < 0) {
throw new IllegalStateException("Invalid string pool position: " + poolPosition);
}
final int startPosition = mParcel.dataPosition();
// The pool is at the end of the parcel.