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

Commit 1b5a7ee3 authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Check service binders before dereferencing them

Bug: 31830499
Test: forced binder to NULL and made sure it failed gracefully
Change-Id: I2c0377fbed9e489d7024da44a6092bec6de1fa3b
parent ad111520
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -684,10 +684,18 @@ sp<MediaPlayerBase> MediaPlayerService::Client::setDataSource_pre(

    sp<IServiceManager> sm = defaultServiceManager();
    sp<IBinder> binder = sm->getService(String16("media.extractor"));
    if (binder == NULL) {
        ALOGE("extractor service not available");
        return NULL;
    }
    mExtractorDeathListener = new ServiceDeathNotifier(binder, p, MEDIAEXTRACTOR_PROCESS_DEATH);
    binder->linkToDeath(mExtractorDeathListener);

    binder = sm->getService(String16("media.codec"));
    if (binder == NULL) {
        ALOGE("codec service not available");
        return NULL;
    }
    mCodecDeathListener = new ServiceDeathNotifier(binder, p, MEDIACODEC_PROCESS_DEATH);
    binder->linkToDeath(mCodecDeathListener);