diff options
author | qiankun.miao <qiankun.miao@intel.com> | 2016-03-18 20:07:38 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-19 03:09:05 +0000 |
commit | 5d1ec3fa66bad70c72bfc28a4f07359f751c44bb (patch) | |
tree | d488d846e1818e1cd9abe6e72fb6f45ae6a71403 | |
parent | 943cc76639df0d20dda0c9891e08ec38fe19540f (diff) | |
download | chromium_src-5d1ec3fa66bad70c72bfc28a4f07359f751c44bb.zip chromium_src-5d1ec3fa66bad70c72bfc28a4f07359f751c44bb.tar.gz chromium_src-5d1ec3fa66bad70c72bfc28a4f07359f751c44bb.tar.bz2 |
Fix texImage without bound pixel unpack buffer
If no WebGLBuffer is bound to PIXEL_UNPACK_BUFFER, INVALID_OPERATION
should be generated. Otherwise, it crashes renderer process.
BUG=295792
CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel
Review URL: https://codereview.chromium.org/1816503002
Cr-Commit-Position: refs/heads/master@{#382175}
-rw-r--r-- | third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp index b0ebb35..543953a 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp @@ -847,6 +847,10 @@ void WebGL2RenderingContextBase::texImage2D(GLenum target, GLint level, GLint in return; if (!validateTexture2DBinding("texImage2D", target)) return; + if (!m_boundPixelUnpackBuffer) { + synthesizeGLError(GL_INVALID_OPERATION, "texImage2D", "no bound PIXEL_UNPACK_BUFFER"); + return; + } if (!validateTexFunc("texImage2D", TexImage, SourceUnpackBuffer, target, level, internalformat, width, height, 1, border, format, type, 0, 0, 0)) return; if (!validateValueFitNonNegInt32("texImage2D", "offset", offset)) @@ -861,6 +865,10 @@ void WebGL2RenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint return; if (!validateTexture2DBinding("texSubImage2D", target)) return; + if (!m_boundPixelUnpackBuffer) { + synthesizeGLError(GL_INVALID_OPERATION, "texSubImage2D", "no bound PIXEL_UNPACK_BUFFER"); + return; + } if (!validateTexFunc("texSubImage2D", TexSubImage, SourceUnpackBuffer, target, level, 0, width, height, 1, 0, format, type, xoffset, yoffset, 0)) return; if (!validateValueFitNonNegInt32("texSubImage2D", "offset", offset)) @@ -979,6 +987,10 @@ void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in return; if (!validateTexture3DBinding("texImage3D", target)) return; + if (!m_boundPixelUnpackBuffer) { + synthesizeGLError(GL_INVALID_OPERATION, "texImage3D", "no bound PIXEL_UNPACK_BUFFER"); + return; + } if (!validateTexFunc("texImage3D", TexImage, SourceUnpackBuffer, target, level, internalformat, width, height, depth, border, format, type, 0, 0, 0)) return; if (!validateValueFitNonNegInt32("texImage3D", "offset", offset)) @@ -1051,6 +1063,10 @@ void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint return; if (!validateTexture3DBinding("texSubImage3D", target)) return; + if (!m_boundPixelUnpackBuffer) { + synthesizeGLError(GL_INVALID_OPERATION, "texSubImage3D", "no bound PIXEL_UNPACK_BUFFER"); + return; + } if (!validateTexFunc("texSubImage3D", TexSubImage, SourceUnpackBuffer, target, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset)) return; if (!validateValueFitNonNegInt32("texSubImage3D", "offset", offset)) |