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

Commit 47480f85 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix null-dereference READ in android::AudioPolicyConfig::addDevice"...

Merge "Fix null-dereference READ in android::AudioPolicyConfig::addDevice" into main am: 0c99f4c0 am: 1bfc9826 am: 7c7ed5ab

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2736474



Change-Id: I987e2d10b38639e452509628624d7d6ed06cc6e2
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 8c4b5fdf 7c7ed5ab
Loading
Loading
Loading
Loading
+27 −17
Original line number Diff line number Diff line
@@ -618,14 +618,16 @@ std::variant<status_t, RouteTraits::Element> PolicySerializer::deserialize<Route
    }
    // Convert Sink name to port pointer
    sp<PolicyAudioPort> sink = ctx->findPortByTagName(sinkAttr);
    if (sink == NULL && !mIgnoreVendorExtensions) {
        ALOGE("%s: no sink found with name=%s", __func__, sinkAttr.c_str());
    if (sink == NULL) {
        if (!mIgnoreVendorExtensions) {
            ALOGE("%s: no sink found with name \"%s\"", __func__, sinkAttr.c_str());
            return BAD_VALUE;
    } else if (sink == NULL) {
        ALOGW("Skipping route to sink \"%s\" as it likely has vendor extension type",
                sinkAttr.c_str());
        } else {
            ALOGW("%s: skipping route to sink \"%s\" as it likely has vendor extension type",
                  __func__, sinkAttr.c_str());
            return NO_INIT;
        }
    }
    route->setSink(sink);

    std::string sourcesAttr = getXmlAttribute(cur, Attributes::sources);
@@ -641,12 +643,14 @@ std::variant<status_t, RouteTraits::Element> PolicySerializer::deserialize<Route
    while (devTag != NULL) {
        if (strlen(devTag) != 0) {
            sp<PolicyAudioPort> source = ctx->findPortByTagName(devTag);
            if (source == NULL && !mIgnoreVendorExtensions) {
                ALOGE("%s: no source found with name=%s", __func__, devTag);
            if (source == NULL) {
                if (!mIgnoreVendorExtensions) {
                    ALOGE("%s: no source found with name \"%s\"", __func__, devTag);
                    return BAD_VALUE;
            } else if (source == NULL) {
                ALOGW("Skipping route source \"%s\" as it likely has vendor extension type",
                        devTag);
                } else {
                    ALOGW("%s: skipping route source \"%s\" as it likely has vendor extension type",
                          __func__, devTag);
                }
            } else {
                sources.add(source);
            }
@@ -728,10 +732,16 @@ std::variant<status_t, ModuleTraits::Element> PolicySerializer::deserialize<Modu
                        sp<DeviceDescriptor> device = module->getDeclaredDevices().
                                getDeviceFromTagName(std::string(reinterpret_cast<const char*>(
                                                        attachedDevice.get())));
                        if (device == nullptr && mIgnoreVendorExtensions) {
                            ALOGW("Skipped attached device \"%s\" because it likely uses a vendor"
                                    "extension type",
                        if (device == NULL) {
                            if (mIgnoreVendorExtensions) {
                                ALOGW("%s: skipped attached device \"%s\" because it likely uses a "
                                      "vendor extension type",
                                      __func__,
                                      reinterpret_cast<const char*>(attachedDevice.get()));
                            } else {
                                ALOGE("%s: got null device in %s, \"%s\"", __func__, child->name,
                                      reinterpret_cast<const char*>(attachedDevice.get()));
                            }
                            continue;
                        }
                        ctx->addDevice(device);