Skip to content

Commit 87b6fcd

Browse files
Jayant ChowdharyAndroid Build Coastguard Worker
authored andcommitted
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 6b0bcd60c81003e6a193aeccf44ee03f188e3984) (cherry picked from commit 7bf30cb92ab213c07241ad22def6816ae201dbab)
1 parent 846d7ec commit 87b6fcd

4 files changed

Lines changed: 4 additions & 28 deletions

File tree

core/java/android/hardware/camera2/params/OutputConfiguration.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -631,13 +631,7 @@ public int getSurfaceGroupId() {
631631
new Parcelable.Creator<OutputConfiguration>() {
632632
@Override
633633
public OutputConfiguration createFromParcel(Parcel source) {
634-
try {
635-
OutputConfiguration outputConfiguration = new OutputConfiguration(source);
636-
return outputConfiguration;
637-
} catch (Exception e) {
638-
Log.e(TAG, "Exception creating OutputConfiguration from parcel", e);
639-
return null;
640-
}
634+
return new OutputConfiguration(source);
641635
}
642636

643637
@Override

core/java/android/hardware/camera2/params/SessionConfiguration.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,7 @@ private SessionConfiguration(@NonNull Parcel source) {
143143
new Parcelable.Creator<SessionConfiguration> () {
144144
@Override
145145
public SessionConfiguration createFromParcel(Parcel source) {
146-
try {
147-
SessionConfiguration sessionConfiguration = new SessionConfiguration(source);
148-
return sessionConfiguration;
149-
} catch (Exception e) {
150-
Log.e(TAG, "Exception creating SessionConfiguration from parcel", e);
151-
return null;
152-
}
146+
return new SessionConfiguration(source);
153147
}
154148

155149
@Override

core/java/android/hardware/camera2/params/VendorTagDescriptor.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,7 @@ private VendorTagDescriptor(Parcel source) {
3636
new Parcelable.Creator<VendorTagDescriptor>() {
3737
@Override
3838
public VendorTagDescriptor createFromParcel(Parcel source) {
39-
try {
40-
VendorTagDescriptor vendorDescriptor = new VendorTagDescriptor(source);
41-
return vendorDescriptor;
42-
} catch (Exception e) {
43-
Log.e(TAG, "Exception creating VendorTagDescriptor from parcel", e);
44-
return null;
45-
}
39+
return new VendorTagDescriptor(source);
4640
}
4741

4842
@Override

core/java/android/hardware/camera2/params/VendorTagDescriptorCache.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,7 @@ private VendorTagDescriptorCache(Parcel source) {
3636
new Parcelable.Creator<VendorTagDescriptorCache>() {
3737
@Override
3838
public VendorTagDescriptorCache createFromParcel(Parcel source) {
39-
try {
40-
VendorTagDescriptorCache vendorDescriptorCache = new VendorTagDescriptorCache(source);
41-
return vendorDescriptorCache;
42-
} catch (Exception e) {
43-
Log.e(TAG, "Exception creating VendorTagDescriptorCache from parcel", e);
44-
return null;
45-
}
39+
return new VendorTagDescriptorCache(source);
4640
}
4741

4842
@Override

0 commit comments

Comments
 (0)