Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

glsl-in: Fix panic when culling nested block #1714

Merged
merged 1 commit into from
Feb 4, 2022

Conversation

JCapucho
Copy link
Collaborator

@JCapucho JCapucho commented Feb 3, 2022

Under certatin circumstances the parser would panic because of culling
using an index out of bound, for example take the following code:

{
    x = 1; // Index 0 on nested block
    discard; // Index 1 on nested block
} // Index 0 on block

The parser seeing this would attempt to cull the block using the start
index of 1 which would be out of bound and panic. Now instead the nested
block properly does it's internal culling and the outer block culls
everything after the nested block only.

Under certatin circumstances the parser would panic because of culling
using an index out of bound, for example take the following code:

```glsl
{
    x = 1; // Index 0 on nested block
    discard; // Index 1 on nested block
} // Index 0 on block
```

The parser seeing this would attempt to cull the block using the start
index of 1 which would be out of bound and panic. Now instead the nested
block properly does it's internal culling and the outer block culls
everything after the nested block only.
@kvark kvark merged commit 54c3f51 into gfx-rs:master Feb 4, 2022
@JCapucho JCapucho deleted the glsl-cull branch February 19, 2022 15:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants