From a6743fd2f59a60460d48107ff321ddad969d7bae Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 10 Jul 2024 17:40:46 +0300 Subject: [PATCH] plugins/screencast: Allocate offscreen texture in WindowScreenCastSource::render(QImage) as big as the memfd buffer textureSize() can temporarily mismatch the target buffer size. It can be a problem if glGetTexImage() gets called. glGetTexImage() assumes that the provided buffer is as big as the texture. If it's not, it will write data outside the bounds of the buffer. BUG: 489764 --- src/plugins/screencast/windowscreencastsource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/screencast/windowscreencastsource.cpp b/src/plugins/screencast/windowscreencastsource.cpp index eabc94b7e7..f2a1432e4d 100644 --- a/src/plugins/screencast/windowscreencastsource.cpp +++ b/src/plugins/screencast/windowscreencastsource.cpp @@ -59,7 +59,7 @@ qreal WindowScreenCastSource::devicePixelRatio() const void WindowScreenCastSource::render(QImage *target) { - const auto offscreenTexture = GLTexture::allocate(GL_RGBA8, textureSize()); + const auto offscreenTexture = GLTexture::allocate(GL_RGBA8, target->size()); if (!offscreenTexture) { return; }