aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglrenderingcontext.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2018-06-18 12:01:39 -0400
committerGitHub <noreply@github.com>2018-06-18 12:01:39 -0400
commit1f562af4186285e2fe988634677cfecf6d36bdd8 (patch)
treecf47d8eaa0a546f89a446c33addeaedd336394b8 /components/script/dom/webglrenderingcontext.rs
parentd843a66300bbb11b10438744cad5ad6f8763ae0b (diff)
parent08b193c9220d5ff7452e0753ac17b0660051086a (diff)
downloadservo-1f562af4186285e2fe988634677cfecf6d36bdd8.tar.gz
servo-1f562af4186285e2fe988634677cfecf6d36bdd8.zip
Auto merge of #20699 - simartin:issue_20593, r=nox
Issue #20593: Implement proper checks in WebGLRenderingContext's getFramebufferAttachmentParameter(). Add missing input checks. --- - [X] `./mach build -d` does not report any errors - [X] `./mach build-geckolib` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #20593 - [X] There are tests for these changes <!-- 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/20699) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/webglrenderingcontext.rs')
-rw-r--r--components/script/dom/webglrenderingcontext.rs31
1 files changed, 30 insertions, 1 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 7beeef9261d..60474753eb3 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -2379,7 +2379,36 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
_ => false
};
- if !target_matches || !attachment_matches || !pname_matches {
+ let bound_attachment_matches = match self.bound_framebuffer.get().unwrap().attachment(attachment) {
+ Some(attachment_root) => {
+ match attachment_root {
+ WebGLFramebufferAttachmentRoot::Renderbuffer(_) => {
+ match pname {
+ constants::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE |
+ constants::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME => true,
+ _ => false
+ }
+ },
+ WebGLFramebufferAttachmentRoot::Texture(_) => {
+ match pname {
+ constants::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE |
+ constants::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME |
+ constants::FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL |
+ constants::FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE => true,
+ _ => false
+ }
+ }
+ }
+ },
+ _ => {
+ match pname {
+ constants::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE => true,
+ _ => false
+ }
+ }
+ };
+
+ if !target_matches || !attachment_matches || !pname_matches || !bound_attachment_matches {
self.webgl_error(InvalidEnum);
return NullValue();
}