From 9240d75e5101a69e9a67a44f0ac2432f2d0bb340 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 10 Jul 2024 17:58:17 +0300 Subject: [PATCH] plugins/screencast: Don't download texture data if target size and texture size mismatch If glGetTexImage() gets called, it can write beyond the bounds of the target size. In long term, it would be nice to relax this check. CCBUG: 489764 --- src/plugins/screencast/screencastutils.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/screencast/screencastutils.h b/src/plugins/screencast/screencastutils.h index 4e03f760a4..fa6f887d51 100644 --- a/src/plugins/screencast/screencastutils.h +++ b/src/plugins/screencast/screencastutils.h @@ -41,6 +41,10 @@ static GLenum closestGLType(QImage::Format format) static void doGrabTexture(GLTexture *texture, QImage *target) { + if (texture->size() != target->size()) { + return; + } + const auto context = OpenGlContext::currentContext(); const QSize size = texture->size(); const bool invertNeeded = context->isOpenGLES() ^ (texture->contentTransform() != OutputTransform::FlipY);