From 12358f839a293d7936e12dbabdd1aca953063b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Tue, 19 May 2015 14:35:12 +0200 Subject: [PATCH] no VBO upload for zero vertex count causes out of bounds segfault BUG: 347900 REVIEW: 123865 FIXED-IN: 5.3.1 --- effects/backgroundcontrast/contrast.cpp | 2 ++ effects/blur/blur.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/effects/backgroundcontrast/contrast.cpp b/effects/backgroundcontrast/contrast.cpp index 059a5d85fb..882055b651 100644 --- a/effects/backgroundcontrast/contrast.cpp +++ b/effects/backgroundcontrast/contrast.cpp @@ -230,6 +230,8 @@ void ContrastEffect::uploadRegion(QVector2D *&map, const QRegion ®ion) void ContrastEffect::uploadGeometry(GLVertexBuffer *vbo, const QRegion ®ion) { const int vertexCount = region.rectCount() * 6; + if (!vertexCount) + return; QVector2D *map = (QVector2D *) vbo->map(vertexCount * sizeof(QVector2D)); uploadRegion(map, region); diff --git a/effects/blur/blur.cpp b/effects/blur/blur.cpp index e238bd2ed8..fe0d467b12 100644 --- a/effects/blur/blur.cpp +++ b/effects/blur/blur.cpp @@ -236,6 +236,8 @@ void BlurEffect::uploadRegion(QVector2D *&map, const QRegion ®ion) void BlurEffect::uploadGeometry(GLVertexBuffer *vbo, const QRegion &horizontal, const QRegion &vertical) { const int vertexCount = (horizontal.rectCount() + vertical.rectCount()) * 6; + if (!vertexCount) + return; QVector2D *map = (QVector2D *) vbo->map(vertexCount * sizeof(QVector2D)); uploadRegion(map, horizontal);