From 3339a96ed063989370930fe6afd9063e550348de Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 19 May 2022 12:02:04 +0200 Subject: QPulseAudioSource: fix UB (memcpy() called with nullptr dest) in read() deviceReady() calls read(nullptr, 0), but calling memcpy() with a nullpt destination is UB, even if the length is simulateneously zero. Ditto applyVolume() (called from read()). Fix by guarding the memcpy() calls. Add assertions to indicate that for these functions, nullptr is valid input iff length is zero. Found by clangsa's core.NonNullParamChecker. Change-Id: I9006b0e933e196a7a212e0ebe2bd27f6b9552518 Reviewed-by: Rafael Roquetto (cherry picked from commit 8df415d5bcf23462bedb4cb7601b909851ee15dd) --- src/plugins/pulseaudio/qaudioinput_pulse.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/pulseaudio/qaudioinput_pulse.cpp b/src/plugins/pulseaudio/qaudioinput_pulse.cpp index 7be7c9a5a..ab8dbbf31 100644 --- a/src/plugins/pulseaudio/qaudioinput_pulse.cpp +++ b/src/plugins/pulseaudio/qaudioinput_pulse.cpp @@ -402,6 +402,8 @@ int QPulseAudioInput::bytesReady() const qint64 QPulseAudioInput::read(char *data, qint64 len) { + Q_ASSERT(data != nullptr || len == 0); + m_bytesAvailable = checkBytesReady(); setError(QAudio::NoError); @@ -411,7 +413,8 @@ qint64 QPulseAudioInput::read(char *data, qint64 len) if (!m_pullMode && !m_tempBuffer.isEmpty()) { readBytes = qMin(static_cast(len), m_tempBuffer.size()); - memcpy(data, m_tempBuffer.constData(), readBytes); + if (readBytes) + memcpy(data, m_tempBuffer.constData(), readBytes); m_totalTimeValue += readBytes; if (readBytes < m_tempBuffer.size()) { @@ -502,9 +505,10 @@ qint64 QPulseAudioInput::read(char *data, qint64 len) void QPulseAudioInput::applyVolume(const void *src, void *dest, int len) { + Q_ASSERT((src && dest) || len == 0); if (m_volume < 1.f) QAudioHelperInternal::qMultiplySamples(m_volume, m_format, src, dest, len); - else + else if (len) memcpy(dest, src, len); } -- cgit v1.2.3 From 76cb7c3f8979e040838dc6c08c4c7df5dac191b5 Mon Sep 17 00:00:00 2001 From: Tunahan Erkoyuncu Date: Thu, 26 May 2022 11:21:37 +0300 Subject: Fix compile error on videonode plugin Fixes compile error on imx6 toolchains that uses old version of gst. Change-Id: Ic1c6d62355ab9208204583103e99a2c8b52acee2 Reviewed-by: Lars Knoll (cherry picked from commit 85a1b7e3a6d91b018863aabe243f3fd03865733e) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp b/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp index 2320197e3..293792a2d 100644 --- a/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp +++ b/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp @@ -51,7 +51,9 @@ #include #include "private/qgstvideobuffer_p.h" +#if GST_CHECK_VERSION(1,14,0) #include +#endif //#define QT_VIVANTE_VIDEO_DEBUG -- cgit v1.2.3 From f6410082293a78c803ff1ad13117f915f8f9935b Mon Sep 17 00:00:00 2001 From: Tarja Sundqvist Date: Wed, 15 Jun 2022 20:08:10 +0300 Subject: Bump version --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 5e6fec742..259b036a0 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -2,4 +2,4 @@ load(qt_build_config) DEFINES += QT_NO_FOREACH QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST -MODULE_VERSION = 5.15.10 +MODULE_VERSION = 5.15.11 -- cgit v1.2.3 From b07ef248f60d620c7710a69507c0627dfaa3f851 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Tue, 14 Jun 2022 17:37:24 +1000 Subject: QNX: fix KHR image handling Textures previously bound to KHR image sources cannot be reused/bound to a newly created KHR image - at least not on QNX. Ensure that a new texture is created before binding a new KHR image. Change-Id: I1b02034336e5685bb9836a79433ef63f5d8c855f Reviewed-by: Lars Knoll Reviewed-by: Dan Cape Reviewed-by: James McDonnell (cherry picked from commit 21dad3632dec5e5ea7c9d45bba927aba2b8e23ea) Reviewed-by: Rafael Roquetto --- src/plugins/qnx/common/windowgrabber.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/qnx/common/windowgrabber.cpp b/src/plugins/qnx/common/windowgrabber.cpp index eeef20795..305652073 100644 --- a/src/plugins/qnx/common/windowgrabber.cpp +++ b/src/plugins/qnx/common/windowgrabber.cpp @@ -393,8 +393,12 @@ GLuint WindowGrabberImage::getTexture(screen_window_t window, const QSize &size) { if (size != m_size) { - if (!m_glTexture) - glGenTextures(1, &m_glTexture); + // create a brand new texture to be the KHR image sibling, as + // previously used textures cannot be reused with new KHR image + // sources - note that glDeleteTextures handles nullptr gracefully + glDeleteTextures(1, &m_glTexture); + glGenTextures(1, &m_glTexture); + glBindTexture(GL_TEXTURE_2D, m_glTexture); if (m_eglImage) { glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, 0); -- cgit v1.2.3 From 1dca8d87a1317d2a69384e4cff8d486a4b12e432 Mon Sep 17 00:00:00 2001 From: Samuel Mira Date: Thu, 16 Jun 2022 16:02:07 +0300 Subject: Android: Align emit sequence Change the emit sequence according to match docs and other platforms. Fixes: QTBUG-104041 Change-Id: Ic7a3b25d0b0538414b5b467b57a61790238692ed Reviewed-by: Qt CI Bot Reviewed-by: Ville Voutilainen --- .../android/src/mediacapture/qandroidcapturesession.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp b/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp index 276bc4975..03d04341f 100644 --- a/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp +++ b/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp @@ -302,9 +302,20 @@ void QAndroidCaptureSession::start() m_cameraSession->camera()->setupPreviewFrameCallback(); } + QMediaRecorder::State oldState = m_state; + QMediaRecorder::Status oldStatus = m_status; + m_state = QMediaRecorder::RecordingState; - emit stateChanged(m_state); - setStatus(QMediaRecorder::RecordingStatus); + m_status = QMediaRecorder::RecordingStatus; + + m_actualOutputLocation = m_usedOutputLocation; + emit actualLocationChanged(m_actualOutputLocation); + + if (m_state != oldState) + emit stateChanged(m_state); + + if (m_status != oldStatus) + emit statusChanged(m_status); } void QAndroidCaptureSession::stop(bool error) -- cgit v1.2.3 From 11c4ad2c8a39819c9359341ef0145984b9ac16d0 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 17 Jun 2022 15:35:05 +0200 Subject: QAudioHelpers: fix C++20 -Werror,-Wdeprecated-enum-float-conversion Says Clang 10.0.0 -std=c++20: qaudiohelpers.cpp:71:44: error: arithmetic between enumeration type 'QAudioHelperInternal::signedVersion::(anonymous enum at /home/marc/Qt/qt5/qtmultimedia/src/multimedia/audio/qaudiohelpers.cpp:63:5)' and floating-point type 'double' is deprecated [-Werror,-Wdeprecated-enum-float-conversion] pDst[i] = signedVersion::offset + ((typename signedVersion::TS)(pSrc[i] - signedVersion::offset) * factor); ~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix by turning the enum { offset } into a static constexpr int instead. Manual conflict resolutions: - extended the fix to the Qt5-only quint{16,32} specializations which are missing from the Qt 6 code. For the quint32 code, chose uint as decltype(offset), because 0x8000'0000 is not a proper value for int, and the subtraction for which offset is used doesn't promote its arguents to int, like for quint{8,16}, but stays in uint space, so an uint offset is suitable. Task-number: QTBUG-104172 Change-Id: I92a22583fc5e1fc524364b64701aa8d416b82671 Reviewed-by: Lars Knoll (cherry picked from commit 94d43085b3f3327b2bf2d644c5f984391f608d3a) Reviewed-by: Sona Kurazyan --- src/multimedia/audio/qaudiohelpers.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/multimedia/audio/qaudiohelpers.cpp b/src/multimedia/audio/qaudiohelpers.cpp index aba4ae38f..2e31286d7 100644 --- a/src/multimedia/audio/qaudiohelpers.cpp +++ b/src/multimedia/audio/qaudiohelpers.cpp @@ -103,19 +103,19 @@ template struct signedVersion {}; template<> struct signedVersion { typedef qint8 TS; - enum {offset = 0x80}; + static constexpr int offset = 0x80; }; template<> struct signedVersion { typedef qint16 TS; - enum {offset = 0x8000}; + static constexpr int offset = 0x8000; }; template<> struct signedVersion { typedef qint32 TS; - enum {offset = 0x80000000}; + static constexpr uint offset = 0x80000000; }; template void adjustUnsignedSamples(qreal factor, const void *src, void *dst, int samples) -- cgit v1.2.3