Index: Source/core/html/canvas/WebGLRenderingContextBase.cpp |
diff --git a/Source/core/html/canvas/WebGLRenderingContextBase.cpp b/Source/core/html/canvas/WebGLRenderingContextBase.cpp |
index 7dc0124aabcabc2cf7850c1dab72c0e3b4b02f00..04c09abce23303508f49304394da37a391c32974 100644 |
--- a/Source/core/html/canvas/WebGLRenderingContextBase.cpp |
+++ b/Source/core/html/canvas/WebGLRenderingContextBase.cpp |
@@ -1010,6 +1010,9 @@ |
// This is an approximation because at WebGLRenderingContextBase level we don't |
// know if the underlying FBO uses textures or renderbuffers. |
GLint maxSize = std::min(m_maxTextureSize, m_maxRenderbufferSize); |
+ // Limit drawing buffer size to 4k to avoid memory exhaustion. |
+ const int sizeUpperLimit = 4096; |
+ maxSize = std::min(maxSize, sizeUpperLimit); |
GLint maxWidth = std::min(maxSize, m_maxViewportDims[0]); |
GLint maxHeight = std::min(maxSize, m_maxViewportDims[1]); |
width = clamp(width, 1, maxWidth); |