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

            Bug ID: 527098
           Summary: QMap iterator invalidation in
                    ModemDevicePrivate::interfaces()
    Classification: Frameworks and Libraries
           Product: frameworks-modemmanager-qt
      Version First 6.13.0
       Reported In:
          Platform: Compiled Sources
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
  Target Milestone: ---

DESCRIPTION
modemmanager-qt 6.13.0 can crash in
ModemManager::ModemDevicePrivate::interfaces() while processing a
DBus InterfacesRemoved signal.

STEPS TO REPRODUCE
Cannot reproduce 100% of times, but *sometimes* my application crashes when
dbus InterfacesRemoved signal is fired, at system shutdown.

Here a core dump excerpt:

#0 std::_Rb_tree_increment(std::_Rb_tree_node_base const*)
#1 std::_Rb_tree_const_iterator<...>::operator++()
#2 QMap<...>::const_iterator::operator++()
#3 ModemManager::ModemDevicePrivate::interfaces()
#4 ModemManager::ModemDevice::interfaces()
#5 ModemManager::ModemManagerPrivate::onInterfacesRemoved()

the reason seems to be ModemDevicePrivate::interfaces() iterating over
interfaceList using a
const iterator and calls interface(i.key()). The interface() function may write
to the same QMap through interfaceList[type] when lazily creating an interface.
This can invalidate the iterator, after which ++i enters
std::_Rb_tree_increment() and crashes.

OBSERVED RESULT
Application crashes with sig 11

EXPECTED RESULT
Application quitting correctly.

SOFTWARE/OS VERSIONS
Operating System custom yocto build.
Qt Version: 6.8.3

ADDITIONAL INFORMATION
Here a possibile fix: iterate over a snapshot of the keys instead of holding an
iterator into interfaceList (I am currently testing this solution).

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

Reply via email to