Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7bf30cb9 authored by Jayant Chowdhary's avatar Jayant Chowdhary
Browse files

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: default avatarJayant Chowdhary <jchowdhary@google.com>
(cherry picked from commit 6b0bcd60)
parent 97626673
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -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
+1 −7
Original line number Diff line number Diff line
@@ -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
+1 −7
Original line number Diff line number Diff line
@@ -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
+1 −7
Original line number Diff line number Diff line
@@ -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