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

wgpu_core::Device::buffer_map_async doesn't bounds-check range #2935

Closed
jimblandy opened this issue Aug 2, 2022 · 0 comments · Fixed by #2938
Closed

wgpu_core::Device::buffer_map_async doesn't bounds-check range #2935

jimblandy opened this issue Aug 2, 2022 · 0 comments · Fixed by #2938
Labels
area: validation Issues related to validation, diagnostics, and error handling

Comments

@jimblandy
Copy link
Member

The wgpu_core::Device::buffer_map_async function doesn't bounds-check range. As far as I can tell, an invalid range will get stashed in wgpu_core::resource::Buffer::map_state, yoinked out in LifetimeTracker::handle_mapping, and make it all the way to the wgpu_hal::Device::map_buffer call in wgpu_core::device::map_buffer, which is much farther than it should get.

Granted, wgpu doesn't need that validation, since it makes map_async a method on BufferSlice, whose length is already validated. But I think the checks are pretty cheap compared to everything else that's going on there, and having them in wgpu_core would benefit all the different language bindings, and Firefox.

@jimblandy jimblandy added the area: validation Issues related to validation, diagnostics, and error handling label Aug 2, 2022
@nical nical mentioned this issue Aug 3, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: validation Issues related to validation, diagnostics, and error handling
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant