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

Commit cc69c53a authored by Devin Moore's avatar Devin Moore
Browse files

Check for mTheRealServiceManager nullptr in getInterfaceDescriptor

It may be nullptr, so don't dereference it. Return an empty String16 in
this case because the binder is not backed by anything.

Flag: EXEMPT bug fix
Test: out/host/linux-x86/fuzz/x86_64/binder_parcel_fuzzer
Bug: none
Change-Id: I5043b6028812205e78405d9e47d0947a16279573
parent 55d0f498
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -154,10 +154,16 @@ public:
    void enableAddServiceCache(bool value) { mEnableAddServiceCache = value; }
    // for legacy ABI
    const String16& getInterfaceDescriptor() const override {
        if (mTheRealServiceManager == nullptr) return mNullInterfaceDescriptor;
        return mTheRealServiceManager->getInterfaceDescriptor();
    }

private:
    // Empty descriptor in case there is no mTheRealServiceManager. We need an
    // object to return a String& reference and there is only expected to be a
    // single BackendUnifiedServiceManager per-process, so this is a member
    // variable.
    const String16 mNullInterfaceDescriptor;
    bool mEnableAddServiceCache = true;
    std::shared_ptr<BinderCacheWithInvalidation> mCacheForGetService;
    sp<os::IServiceManager> mTheRealServiceManager;