From e255a01ce3b9f94a1bf96f7fe37a9b9de2c26183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 28 Apr 2017 21:37:38 +0200 Subject: [PATCH] SVGA3D: disable GL_ARB_get_texture_sub_image altogether. In some cases it causes OOB writes, corrupting application memory. Nasty. --- src/Magnum/Implementation/driverSpecific.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Magnum/Implementation/driverSpecific.cpp b/src/Magnum/Implementation/driverSpecific.cpp index 1659ea33a..cfbf8d041 100644 --- a/src/Magnum/Implementation/driverSpecific.cpp +++ b/src/Magnum/Implementation/driverSpecific.cpp @@ -97,6 +97,11 @@ namespace { vertex buffer memory is initialized using glNamedBufferData() from ARB_DSA. Using the non-DSA glBufferData() works. */ "svga3d-broken-dsa-bufferdata", + + /* SVGA3D does out-of-bound writes in some cases of glGetTexSubImage(), + leading to memory corruption on client machines. That's nasty, so the + whole ARB_get_texture_sub_image is disabled. */ + "svga3d-gettexsubimage-oob-write", #endif }; } @@ -257,6 +262,13 @@ void Context::setupDriverWorkarounds() { } #endif + #ifndef MAGNUM_TARGET_GLES + if((detectedDriver() & DetectedDriver::Svga3D) && + isExtensionSupported() && + !isDriverWorkaroundDisabled("svga3d-gettexsubimage-oob-write")) + _setRequiredVersion(GL::ARB::get_texture_sub_image, None); + #endif + #undef _setRequiredVersion }