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

Commit e8cd125e authored by Wonsik Kim's avatar Wonsik Kim Committed by Gerrit Code Review
Browse files

Merge "Fix MediaCodec potential use-after-free" into main

parents 20c9bba5 0f56965e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -12,6 +12,16 @@ flag {
  bug: "201479783"
}

flag {
  name: "set_state_early"
  namespace: "codec_fwk"
  description: "Bugfix flag for setting state early to avoid a race condition"
  bug: "298613712"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "dynamic_color_aspects"
  is_exported: true
+7 −1
Original line number Diff line number Diff line
@@ -6052,6 +6052,10 @@ void MediaCodec::setState(State newState) {
        mErrorLog.clear();
    }

    if (android::media::codec::provider_->set_state_early()) {
        mState = newState;
    }

    if (newState == UNINITIALIZED) {
        // return any straggling buffers, e.g. if we got here on an error
        returnBuffersToCodec();
@@ -6062,7 +6066,9 @@ void MediaCodec::setState(State newState) {
        mFlags &= ~kFlagSawMediaServerDie;
    }

    if (!android::media::codec::provider_->set_state_early()) {
        mState = newState;
    }

    if (mBatteryChecker != nullptr) {
        mBatteryChecker->setExecuting(isExecuting());