diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-11-17 16:47:14 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-17 16:47:14 -0500 |
commit | 34bf312e0caa030b1bbda7b27317c7112ff051c7 (patch) | |
tree | 00834abdeacd60f6f46ab2ea6231afbd51368ef6 /components/script/dom/webglrenderingcontext.rs | |
parent | 73bb458cf53587e543401ebdf9a2452a8b0ad190 (diff) | |
parent | 4b5b3c3adb11b7eb8c123bc67ae5e852589ce18f (diff) | |
download | servo-34bf312e0caa030b1bbda7b27317c7112ff051c7.tar.gz servo-34bf312e0caa030b1bbda7b27317c7112ff051c7.zip |
Auto merge of #22214 - jabedude:validate-argument, r=jdm
Add GetShaderPrecisionFormat argument validation
This patch adds a check on the shader_type argument. If it is not one either
FRAGMENT_SHADER or VERTEX_SHADER, we return INVALID_ENUM.
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #22080
<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because @jdm wants to wait until the PR is open to test.
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22214)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/webglrenderingcontext.rs')
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index a21d3898112..88948343bdd 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -2549,6 +2549,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { shader_type: u32, precision_type: u32, ) -> Option<DomRoot<WebGLShaderPrecisionFormat>> { + match shader_type { + constants::FRAGMENT_SHADER | constants::VERTEX_SHADER => (), + _ => { + self.webgl_error(InvalidEnum); + return None; + }, + } + match precision_type { constants::LOW_FLOAT | constants::MEDIUM_FLOAT | |