Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-61085

Crash in OpenSLES audio plugin

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.8.0, 5.9.0
    • Multimedia
    • Android

      gcc 4.9

    Description

      We were investigating weird crashes of our app and it led us to discovering a bug in OpenSLES audio plugin in Qt Multimedia.
      File qopenslesaudioinput.cpp has a method flushBuffers which contains the following code: 

      if (delta > 0)
          writeDataToDevice(m_buffers[m_currentBuffer].constData(), m_format.bytesForDuration(delta));
      

      but it may so happen (and it was happening from time to time in our app), that ```m_format.bytesForDuration(delta)``` is larger than the QByteArray containing the data.
      writeDataToDevice does QByteArray::append(data, size); so it's obvious that the size cannot be larger than the data stored under the pointer passed to this function.

      We've fixed this issue by simply changing these lines to:

      if (delta > 0)
         writeDataToDevice(m_buffers[m_currentBuffer].constData(), std::min(m_buffers[m_currentBuffer].size(), m_format.bytesForDuration(delta)));

      Attachments

        For Gerrit Dashboard: QTBUG-61085
        # Subject Branch Project Status CR V

        Activity

          People

            ylopes Yoann Lopes
            misalmel Mika Salmela
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes