https://bugs.kde.org/show_bug.cgi?id=520145

--- Comment #1 from [email protected] ---
Addtional information:
I'm using a single external monitor connected by displayport. And I also tried
HDMI, the bug still reproduced. Plus, this behavior never happened before 6.6.5
Then I looked into the source code and found a likely reason:

        if (!deviceOutput) {
            // still not found
            if (internalOutput) {
                // we have an internal id, so let's use that
                deviceOutput = internalOutput;
            } else {
                // just take first screen, we have no clue
                deviceOutput = outputs.front();
            }
        }
    }

    device->setOutput(deviceOutput);

Guess from the snippet from void Connection::applyScreenToDevice(Device
*device): When the only monitor is temporarily disconnected (due to monitor
poweroff), the outputs list fetched from the backend becomes completely empty.
Since internalOutput is null on a desktop, the code is forced into the else
branch, executing deviceOutput = outputs.front();. On an empty QList, this
triggers undefined behavior. Even if it doesn't crash immediately on front(),
deviceOutput will be assigned an invalid value or nullptr. Passing this
unvalidated pointer straight into device->setOutput(deviceOutput); right after
will inevitably cause a null pointer dereference / Segmentation Fault inside
the input device initialization.
Maybe a boundary check may work?

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to