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

--- Comment #7 from Elvis Angelaccio <elvis.angelac...@kde.org> ---
Git commit 6010d09233e5bb7a00606c44a2fbe5898ecc36e0 by Elvis Angelaccio, on
behalf of Jaime Torres.
Committed on 16/08/2018 at 08:58.
Pushed by elvisangelaccio into branch 'Applications/18.08'.

Avoid a kio-mtp crash when trying to add a blocked device to the device cache

Summary:
When the device is blocked, for example by amarok mtp plugin, the result of
LIBMTP_Open_Raw_Device_Uncached(rawDevice) is nullptr and
LIBMTP_Get_Friendlyname(nullptr) crashes.

Avoid to create a cache for a device that can't be opened.

Test Plan:
With Amarok started and its mtp plugin enabled, plug in an android device.
Try to open it with dolphin, always the same kio backtrace:

```
==13233== Invalid read of size 8
==13233==    at 0x1087ABCE: LIBMTP_Get_Friendlyname (in
/usr/lib64/libmtp.so.9.4.0)
==13233==    by 0x105EE67C:
CachedDevice::CachedDevice(LIBMTP_mtpdevice_struct*, LIBMTP_raw_device_struct*,
QString, int) (devicecache.cpp:44)
==13233==    by 0x105F0A30: DeviceCache::checkDevice(Solid::Device)
(devicecache.cpp:150)
==13233==    by 0x105F1517: DeviceCache::DeviceCache(int, QObject*)
(devicecache.cpp:94)
==13233==    by 0x105F2FC1: MTPSlave::MTPSlave(QByteArray const&, QByteArray
const&) (kio_mtp.cpp:70)
==13233==    by 0x105F8BF9: kdemain (kio_mtp.cpp:54)
==13233==    by 0x4016CC: main (kioslave.cpp:130)
==13233==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
```
And in dolphin, the message: MTP died unexpectedly

After, the message: The file or folder
udi=/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1 does not
exist.

Reviewers: #frameworks, elvisangelaccio

Reviewed By: elvisangelaccio

Subscribers: broulik

Differential Revision: https://phabricator.kde.org/D14158

M  +1    -1    mtp/devicecache.cpp

https://commits.kde.org/kio-extras/6010d09233e5bb7a00606c44a2fbe5898ecc36e0

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

Reply via email to