Use a securely seeded global PRNG for the VM.

It's not 2005 anymore.
This commit is contained in:
Mike Pall
2020-06-15 12:21:05 +02:00
parent 34e53736c6
commit a44f53acf5
22 changed files with 411 additions and 174 deletions

View File

@@ -345,17 +345,13 @@ LUALIB_API lua_State *luaL_newstate(void)
#else
#include "lj_alloc.h"
LUALIB_API lua_State *luaL_newstate(void)
{
lua_State *L;
void *ud = lj_alloc_create();
if (ud == NULL) return NULL;
#if LJ_64 && !LJ_GC64
L = lj_state_newstate(lj_alloc_f, ud);
L = lj_state_newstate(LJ_ALLOCF_INTERNAL, NULL);
#else
L = lua_newstate(lj_alloc_f, ud);
L = lua_newstate(LJ_ALLOCF_INTERNAL, NULL);
#endif
if (L) G(L)->panic = panic;
return L;