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

Naga constant evaluation can use too much memory #6872

Open
jimblandy opened this issue Jan 7, 2025 · 1 comment
Open

Naga constant evaluation can use too much memory #6872

jimblandy opened this issue Jan 7, 2025 · 1 comment
Labels
area: validation Issues related to validation, diagnostics, and error handling naga Shader Translator

Comments

@jimblandy
Copy link
Member

The OSS Fuzz project found this test case, that causes Naga to use more than 2560MiB of memory:

fn g(){7=6<array<f32,49496295>();}

This is slightly surprising, because that should only be a 4 * ~50M = ~200MiB value. I'm pretty sure I have that limit right.

OSS Fuzz claims we fixed this, but I doubt it.

I feel like we should impose some sort of reasonable limit on these things, but addressing these problems case-by-case would take forever. Ideally, the architecture would put obvious overall bounds on the amount of memory that constant evaluation might consume - say, by monitoring the size of the expression arena, in a way that counts heap-allocated memory owned by arena elements.

@jimblandy jimblandy added area: validation Issues related to validation, diagnostics, and error handling naga Shader Translator labels Jan 7, 2025
@teoxoy
Copy link
Member

teoxoy commented Jan 13, 2025

We can probably resolve this by implementing the limit for array sizes (#4546).

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 naga Shader Translator
Projects
Status: Todo
Development

No branches or pull requests

2 participants