Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate the number of color attachments in create_render_pipeline #2913

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

nical
Copy link
Contributor

@nical nical commented Jul 25, 2022

Checklist

  • Run cargo clippy.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections

Found by a fuzzer in https://bugzilla.mozilla.org/show_bug.cgi?id=1780791

Description

create_render_pipeline panics if the number of color attachments is greater than hal::MAX_COLOR_ATTACHMENTS.

This PR checks and returns an error. This validation is also part of the WebGPU spec (although the limit is advertized via a member of GPUSupportedLimits instead of a constant).

Testing

None.

nical added 2 commits July 25, 2022 15:26
Returns an error instead of panicking when populating an ArrayVec later in the same function.
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

return Err(
pipeline::CreateRenderPipelineError::TooManyColorAttachments {
given: num_attachments as u32,
limit: hal::MAX_COLOR_ATTACHMENTS as u32,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long term we should add this limit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants