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
This commit is contained in:
Vlad Zahorodnii 2024-07-10 17:58:17 +03:00
parent a6743fd2f5
commit 9240d75e51

View file

@ -41,6 +41,10 @@ static GLenum closestGLType(QImage::Format format)
static void doGrabTexture(GLTexture *texture, QImage *target) static void doGrabTexture(GLTexture *texture, QImage *target)
{ {
if (texture->size() != target->size()) {
return;
}
const auto context = OpenGlContext::currentContext(); const auto context = OpenGlContext::currentContext();
const QSize size = texture->size(); const QSize size = texture->size();
const bool invertNeeded = context->isOpenGLES() ^ (texture->contentTransform() != OutputTransform::FlipY); const bool invertNeeded = context->isOpenGLES() ^ (texture->contentTransform() != OutputTransform::FlipY);