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

Setting zero as device scale factor wrecks havoc #89

Closed
aperezdc opened this issue Dec 16, 2021 · 0 comments · Fixed by #109
Closed

Setting zero as device scale factor wrecks havoc #89

aperezdc opened this issue Dec 16, 2021 · 0 comments · Fixed by #109
Assignees
Labels

Comments

@aperezdc
Copy link
Contributor

Reported by @philn in Igalia/cog#384 (comment):

Also, shouldn't wpe_view_backend_dispatch_set_device_scale_factor() return an error or something when it receives a 0 factor? Because that's wrecking havoc :)

Probably we should check that the requested scaling factor is between reasonable limits, because I do not expect good things to happen by setting it too big either.

@aperezdc aperezdc added the bug label Dec 16, 2021
@aperezdc aperezdc self-assigned this Dec 16, 2021
aperezdc added a commit that referenced this issue Jun 1, 2022
Add a check to constraint the allowed device scale factors to the
[0.05, 5.0] range, ignoring values outside the interval. For debug
builds, an assertion will also make it easier for developers to fix
bugs in code that calls the function with invalid values.

Setting the device scale factor to unreasonably low values can result in
divisions by zero, wrong rendering, and/or odd behaviour in general;
while for too big values graphics buffers will consume unreasonably big
amounts of memory or the maximum usable size for them will result in
failure to allocate buffers and content being partially rendered (if at
all).

Fixes #89
aperezdc added a commit that referenced this issue Jun 1, 2022
Add a check to constraint the allowed device scale factors to the
[0.05, 5.0] range, ignoring values outside the interval. For debug
builds, an assertion will also make it easier for developers to fix
bugs in code that calls the function with invalid values.

Setting the device scale factor to unreasonably low values can result in
divisions by zero, wrong rendering, and/or odd behaviour in general;
while for too big values graphics buffers will consume unreasonably big
amounts of memory or the maximum usable size for them will result in
failure to allocate buffers and content being partially rendered (if at
all).

Fixes #89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant