Skip to content
Commit dff31114 authored by LaughingMan's avatar LaughingMan Committed by Dzmitry Malyshau
Browse files

WGSL front end: Fix panic on invalid input

Until now the WGSL parser would interpret a character index as a byte index.
This could lead to a panic on invalid input strings like "\"\u{2}ПЀ\u{0}\"",
because it would use that index to slice a string without ensuring the slicing
happens on a character boundary.

One possible fix would have been to call `str::find` instead of `position`,
however by relying on `splitn` instead of slicing a str manually it is
easier to convince ourselves that this code can no longer panic.

Fixes https://github.com/gfx-rs/naga/issues/90
parent aa70703f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment