remove lua's ability to load binary chunks

to protect against malware attacks
develop
Myk Taylor 2023-03-25 15:53:42 -07:00
parent 28eeb95eed
commit b3a20e771b
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 6 additions and 6 deletions

@ -767,14 +767,14 @@ static void f_parser (lua_State *L, void *ud) {
LClosure *cl; LClosure *cl;
struct SParser *p = cast(struct SParser *, ud); struct SParser *p = cast(struct SParser *, ud);
int c = zgetc(p->z); /* read first character */ int c = zgetc(p->z); /* read first character */
if (c == LUA_SIGNATURE[0]) { // if (c == LUA_SIGNATURE[0]) {
checkmode(L, p->mode, "binary"); // checkmode(L, p->mode, "binary");
cl = luaU_undump(L, p->z, p->name); // cl = luaU_undump(L, p->z, p->name);
} // }
else { // else {
checkmode(L, p->mode, "text"); checkmode(L, p->mode, "text");
cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c); cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c);
} // }
lua_assert(cl->nupvalues == cl->p->sizeupvalues); lua_assert(cl->nupvalues == cl->p->sizeupvalues);
luaF_initupvals(L, cl); luaF_initupvals(L, cl);
} }