gfx-rs / naga

Universal shader translation in Rust

Home Page:https://github.com/gfx-rs/wgpu/tree/trunk/naga

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OOM triggered when compiling wgsl shader

wgslfuzz opened this issue · comments

On git commit 9eb3a1d naga some kind of resource exhaustion bug when executing naga input.wgsl output.hlsl. Setting a ulimit of 4GB terminates the execution, higher limit fail also.

memory allocation of 4294967296 bytes failed
[1]    1426281 IOT instruction (core dumped) 
@group(0) @binding(2) var g_4: texture_depth_2d_array;
@group(1025612598) @binding(3) var g_5: sampler_comparison;

@fragment
fn fs_main_without_storage() {
    let flip_correction = vec2<f32>(0.0, 0.0) ; 
    textureSampleCompareLevel(g_4, g_5, flip_correction, 0, 0.0); 
} 

Traced it down to this problematic code block:

naga/src/valid/interface.rs

Lines 771 to 773 in 9eb3a1d

while self.bind_group_masks.len() <= bind.group as usize {
self.bind_group_masks.push(BitSet::new());
}