rhysd / vim.wasm

Vim editor ported to WebAssembly
http://rhysd.github.io/vim.wasm
5.51k stars 145 forks source link

Vim crashes with empty string argument #34

Closed rhysd closed 5 years ago

rhysd commented 5 years ago

Describe the bug

When passing an empty string as command line argument of Vim, Vim crashes on start.

Steps To Reproduce

import { VimWasm } from '/path/to/vim-wasm/vimwasm.js';

const vim = new VimWasm({ ... });

vim.start({ debug: true, cmdArgs: [ '' ] });

Run above script in browser and check console in DevTools.

Or access to http://rhysd.github.io/vim.wasm/?arg=

Expected behavior

Vim normally starts with an unnamed buffer

Actual behavior

Vim crashes with following abort error:

worker: Error was thrown in worker: abort("TypeError: Cannot read property 'mode' of null") at Error
    at jsStackTrace (http://localhost:1234/vim.js:1374:13)
    at stackTrace (http://localhost:1234/vim.js:1391:12)
    at abort (http://localhost:1234/vim.js:8200:44)
    at ___syscall33 (http://localhost:1234/vim.js:5581:69)
    at _access (wasm-function[4982]:59)
    at _readfile (wasm-function[1636]:2316)
    at _open_buffer (wasm-function[175]:1086)
    at _create_windows (wasm-function[4640]:792)
    at _vim_main2 (wasm-function[4638]:1543)
    at _wasm_main (wasm-function[4629]:1356)

Screenshots/DevTools console (if possible)

スクリーンショット 2019-08-01 15 50 30

Your environment

Additional context (if any)

rhysd commented 5 years ago

This seems a bug of implementation of access() in emscripten. I created https://github.com/emscripten-core/emscripten/issues/9136

rhysd commented 5 years ago

Fix was merged and the issue was fixed in upstream. With next release, this issue should be fixed.

rhysd commented 5 years ago

emscripten 1.38.41 fixed this issue. I confirmed it with v0.0.12.