summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-28 13:47:18 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-28 13:47:18 +0200
commitc64a3e7596b9e29c58a0a7cdd6574a837e0395e5 (patch)
treee4e6a0bc992830404317db3b86fd6b34897bd561 /src
parent03fa39649de945d5a392f460fd592f815534f69a (diff)
downloadfengari-c64a3e7596b9e29c58a0a7cdd6574a837e0395e5.tar.gz
fengari-c64a3e7596b9e29c58a0a7cdd6574a837e0395e5.tar.bz2
fengari-c64a3e7596b9e29c58a0a7cdd6574a837e0395e5.zip
luaL_loadfilex raise error if filename is not a file
e.g. a directory
Diffstat (limited to 'src')
-rw-r--r--src/lauxlib.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 3851ee7..c6a975c 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -745,6 +745,8 @@ if (!WEB) {
lua.lua_pushliteral(L, `@${jsfilename}`);
try {
lf.f = fs.openSync(jsfilename, "r");
+ if (!fs.fstatSync(lf.f).isFile())
+ throw new Error(`${jsfilename} is not a readable file`);
} catch (e) {
return errfile(L, "open", fnameindex, e);
}