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>() { new Parcelable.Creator<OutputConfiguration>() {
@Override @Override
public OutputConfiguration createFromParcel(Parcel source) { public OutputConfiguration createFromParcel(Parcel source) {
try { return new OutputConfiguration(source);
OutputConfiguration outputConfiguration = new OutputConfiguration(source);
return outputConfiguration;
} catch (Exception e) {
Log.e(TAG, "Exception creating OutputConfiguration from parcel", e);
return null;
}
} }
@Override @Override

View File

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

View File

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

View File

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