camera2: Fix exception swallowing in params classes createFromParcel

Do not catch exceptions when we attempt to create the following classes
from a parcel
- OutputConfiguration
- VendorTagDescriptor
- VendorTagDescriptorCache
- SessionConfiguration
This could cause subsequent parcel information to be read incorrectly.

Bug: 188675581

Test: Sample app which tries to write invalid data into an
      OutputConfiguration parcel to send in an intent via Broadcast. When read by the receiving app,
      gets an exception (not swallowed).

Merged-In: I745ca49daa6ca36b1020d518e9f346b52684f2b1
Change-Id: I745ca49daa6ca36b1020d518e9f346b52684f2b1
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
(cherry picked from commit 6b0bcd60c8)
This commit is contained in:
Jayant Chowdhary
2021-06-09 14:34:54 -07:00
parent 976266733d
commit 7bf30cb92a
4 changed files with 4 additions and 28 deletions

View File

@@ -631,13 +631,7 @@ public final class OutputConfiguration implements Parcelable {
new Parcelable.Creator<OutputConfiguration>() {
@Override
public OutputConfiguration createFromParcel(Parcel source) {
try {
OutputConfiguration outputConfiguration = new OutputConfiguration(source);
return outputConfiguration;
} catch (Exception e) {
Log.e(TAG, "Exception creating OutputConfiguration from parcel", e);
return null;
}
return new OutputConfiguration(source);
}
@Override

View File

@@ -138,13 +138,7 @@ public final class SessionConfiguration implements Parcelable {
new Parcelable.Creator<SessionConfiguration> () {
@Override
public SessionConfiguration createFromParcel(Parcel source) {
try {
SessionConfiguration sessionConfiguration = new SessionConfiguration(source);
return sessionConfiguration;
} catch (Exception e) {
Log.e(TAG, "Exception creating SessionConfiguration from parcel", e);
return null;
}
return new SessionConfiguration(source);
}
@Override

View File

@@ -36,13 +36,7 @@ public final class VendorTagDescriptor implements Parcelable {
new Parcelable.Creator<VendorTagDescriptor>() {
@Override
public VendorTagDescriptor createFromParcel(Parcel source) {
try {
VendorTagDescriptor vendorDescriptor = new VendorTagDescriptor(source);
return vendorDescriptor;
} catch (Exception e) {
Log.e(TAG, "Exception creating VendorTagDescriptor from parcel", e);
return null;
}
return new VendorTagDescriptor(source);
}
@Override

View File

@@ -36,13 +36,7 @@ public final class VendorTagDescriptorCache implements Parcelable {
new Parcelable.Creator<VendorTagDescriptorCache>() {
@Override
public VendorTagDescriptorCache createFromParcel(Parcel source) {
try {
VendorTagDescriptorCache vendorDescriptorCache = new VendorTagDescriptorCache(source);
return vendorDescriptorCache;
} catch (Exception e) {
Log.e(TAG, "Exception creating VendorTagDescriptorCache from parcel", e);
return null;
}
return new VendorTagDescriptorCache(source);
}
@Override