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

Fix editor crash when shader has incorrect global array declaration #90792

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jsjtxietian
Copy link
Contributor

@jsjtxietian jsjtxietian commented Apr 17, 2024

Trying to fix #90683

The crash happens around the change in shader_compiler.cpp, in that condition, cnode->array_declarations[0].initializer has size 0 and thus use i=1 to index it will crash the editor. I leave it as a safe guard there.

Note that const bool array[1] = bool[];; will cause the crash but const bool array[1] = bool[]; won't (just trigger Expected a ',' or ';'), the changes I made in shader_language.cpp prevent this by simply don't allow a global const array to be defined without initialization, I checked the doc it didn't say whether it's legal or not, so it might not be a good idea. Feel free to correct me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Editor Crash When Using Invalid Array Initialization in Shader
3 participants