sifive / wake

The SiFive wake build tool
Other
86 stars 28 forks source link

wake crashes on bad input source #1425

Open ngraybeal opened 1 year ago

ngraybeal commented 1 year ago

I was able to crash Wake language server in Vscode with the following code.

Wake Version: 38.0.0

Running wake gives the following error. wake/wakebox/runners/rhel8-slurm-runner.wake:210:9: multi-argument match requires a multi-argument pattern

Error:

RuntimeError: memory access out of bounds
    at wasm://wasm/007a1372:wasm-function[403]:0xcc52a
    at wasm://wasm/007a1372:wasm-function[403]:0xcbacd
    at wasm://wasm/007a1372:wasm-function[372]:0xbb3b0
    at wasm://wasm/007a1372:wasm-function[372]:0xbc810
    at wasm://wasm/007a1372:wasm-function[372]:0xbc94a
    at wasm://wasm/007a1372:wasm-function[581]:0x12dac1
    at wasm://wasm/007a1372:wasm-function[565]:0x10bd75
    at wasm://wasm/007a1372:wasm-function[558]:0x10782d
[Error - 4:08:01 PM] Request textDocument/definition failed.
  Message: Request textDocument/definition failed with message: memory access out of bounds
  Code: -32603 

Bad code

def foo =
    def bar =
        "apple"
    require Pass (Pair extra base) = match tokenize `-` bar
        (d, h, Nil) -> Pass (Pair d h)
        (h, Nil) -> Pass (Pair "" h)
        _ -> failWithError "Wrong Format"

Good Code

def foo =
    def bar =
        "apple"
    require Pass (Pair extra base) = match (tokenize `-` bar)
        (d, h, Nil) -> Pass (Pair d h)
        (h, Nil) -> Pass (Pair "" h)
        _ -> failWithError "Wrong Format"
V-FEXrt commented 1 year ago

Looks like this isn't specific to the LSP, running wake -x Unit with this file will also crash wake