diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-10-30 18:42:38 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-10-30 18:42:38 +0100 |
commit | d0da27ef572152d1fdd82a9ac15bd5c23ad68160 (patch) | |
tree | a617d33237e64a1f95a09e40c06a962b586583a1 /dom/canvas/WebGLContextBuffers.cpp | |
parent | 0f7f961e8894c8408b7fa21bbeba7ac503d372eb (diff) | |
parent | 50ef259a2df60d020ccb02d76dc5aa4835ee319e (diff) | |
download | UXP-d0da27ef572152d1fdd82a9ac15bd5c23ad68160.tar UXP-d0da27ef572152d1fdd82a9ac15bd5c23ad68160.tar.gz UXP-d0da27ef572152d1fdd82a9ac15bd5c23ad68160.tar.lz UXP-d0da27ef572152d1fdd82a9ac15bd5c23ad68160.tar.xz UXP-d0da27ef572152d1fdd82a9ac15bd5c23ad68160.zip |
Merge branch 'release' into Basilisk-releasev2019.10.31
Diffstat (limited to 'dom/canvas/WebGLContextBuffers.cpp')
-rw-r--r-- | dom/canvas/WebGLContextBuffers.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/dom/canvas/WebGLContextBuffers.cpp b/dom/canvas/WebGLContextBuffers.cpp index af506c01c..f53f9d7d7 100644 --- a/dom/canvas/WebGLContextBuffers.cpp +++ b/dom/canvas/WebGLContextBuffers.cpp @@ -9,6 +9,8 @@ #include "WebGLBuffer.h" #include "WebGLVertexArray.h" +#include "mozilla/CheckedInt.h" + namespace mozilla { WebGLRefPtr<WebGLBuffer>* @@ -345,6 +347,16 @@ WebGLContext::BufferData(GLenum target, WebGLsizeiptr size, GLenum usage) //// + const auto checkedSize = CheckedInt<size_t>(size); + if (!checkedSize.isValid()) + return ErrorOutOfMemory("%s: Size too large for platform.", funcName); + +#if defined(XP_MACOSX) + if (gl->WorkAroundDriverBugs() && size > 1200000000) { + return ErrorOutOfMemory("Allocations larger than 1200000000 fail on MacOS."); + } +#endif + const UniqueBuffer zeroBuffer(calloc(size, 1)); if (!zeroBuffer) return ErrorOutOfMemory("%s: Failed to allocate zeros.", funcName); |