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

Commit 436998b0 authored by George Burgess IV's avatar George Burgess IV
Browse files

MediaCodec: check for exceptions when creating crypto info

NativeCryptoInfo's constructor may throw an exception, which means that
pieces of `cryptoInfo` won't be properly initialized. Check for that
here and let it bubble up.

Bug: 206470603
Test: TreeHugger
Change-Id: Ifcd15a9ac70f5cfa979c58c84461a37a3a03ef90
parent fbfc1da0
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -2432,13 +2432,12 @@ static void android_media_MediaCodec_native_queueLinearBlock(
            throwExceptionAsNecessary(env, BAD_VALUE);
            return;
        }
        NativeCryptoInfo cryptoInfo = [env, cryptoInfoObj, size]{
            if (cryptoInfoObj == nullptr) {
                return NativeCryptoInfo{size};
            } else {
                return NativeCryptoInfo{env, cryptoInfoObj};
        auto cryptoInfo =
                cryptoInfoObj ? NativeCryptoInfo{size} : NativeCryptoInfo{env, cryptoInfoObj};
        if (env->ExceptionCheck()) {
            // Creation of cryptoInfo failed. Let the exception bubble up.
            return;
        }
        }();
        err = codec->queueEncryptedLinearBlock(
                index,
                memory,