diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.dep | 3 | ||||
-rw-r--r-- | src/lib_math.c | 6 | ||||
-rw-r--r-- | src/lj_errmsg.h | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/Makefile.dep b/src/Makefile.dep index fda77c83..e9f83399 100644 --- a/src/Makefile.dep +++ b/src/Makefile.dep | |||
@@ -32,7 +32,8 @@ lib_jit.o: lib_jit.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ | |||
32 | lj_target.h lj_target_*.h lj_trace.h lj_dispatch.h lj_traceerr.h \ | 32 | lj_target.h lj_target_*.h lj_trace.h lj_dispatch.h lj_traceerr.h \ |
33 | lj_vm.h lj_vmevent.h lj_lib.h luajit.h lj_libdef.h | 33 | lj_vm.h lj_vmevent.h lj_lib.h luajit.h lj_libdef.h |
34 | lib_math.o: lib_math.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ | 34 | lib_math.o: lib_math.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ |
35 | lj_def.h lj_arch.h lj_lib.h lj_vm.h lj_prng.h lj_libdef.h | 35 | lj_def.h lj_arch.h lj_err.h lj_errmsg.h lj_lib.h lj_vm.h lj_prng.h \ |
36 | lj_libdef.h | ||
36 | lib_os.o: lib_os.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ | 37 | lib_os.o: lib_os.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ |
37 | lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_buf.h lj_str.h lj_lib.h \ | 38 | lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_buf.h lj_str.h lj_lib.h \ |
38 | lj_libdef.h | 39 | lj_libdef.h |
diff --git a/src/lib_math.c b/src/lib_math.c index 4539f804..08bb7673 100644 --- a/src/lib_math.c +++ b/src/lib_math.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include "lualib.h" | 13 | #include "lualib.h" |
14 | 14 | ||
15 | #include "lj_obj.h" | 15 | #include "lj_obj.h" |
16 | #include "lj_err.h" | ||
16 | #include "lj_lib.h" | 17 | #include "lj_lib.h" |
17 | #include "lj_vm.h" | 18 | #include "lj_vm.h" |
18 | #include "lj_prng.h" | 19 | #include "lj_prng.h" |
@@ -183,7 +184,10 @@ LJLIB_PUSH(top-2) /* Upvalue holds userdata with PRNGState. */ | |||
183 | LJLIB_CF(math_randomseed) | 184 | LJLIB_CF(math_randomseed) |
184 | { | 185 | { |
185 | PRNGState *rs = (PRNGState *)(uddata(udataV(lj_lib_upvalue(L, 1)))); | 186 | PRNGState *rs = (PRNGState *)(uddata(udataV(lj_lib_upvalue(L, 1)))); |
186 | random_seed(rs, lj_lib_checknum(L, 1)); | 187 | if (L->base != L->top) |
188 | random_seed(rs, lj_lib_checknum(L, 1)); | ||
189 | else if (!lj_prng_seed_secure(rs)) | ||
190 | lj_err_caller(L, LJ_ERR_PRNGSD); | ||
187 | return 0; | 191 | return 0; |
188 | } | 192 | } |
189 | 193 | ||
diff --git a/src/lj_errmsg.h b/src/lj_errmsg.h index 127c06da..109e909c 100644 --- a/src/lj_errmsg.h +++ b/src/lj_errmsg.h | |||
@@ -79,6 +79,7 @@ ERRDEF(SETFENV, LUA_QL("setfenv") " cannot change environment of given object") | |||
79 | ERRDEF(CORUN, "cannot resume running coroutine") | 79 | ERRDEF(CORUN, "cannot resume running coroutine") |
80 | ERRDEF(CODEAD, "cannot resume dead coroutine") | 80 | ERRDEF(CODEAD, "cannot resume dead coroutine") |
81 | ERRDEF(COSUSP, "cannot resume non-suspended coroutine") | 81 | ERRDEF(COSUSP, "cannot resume non-suspended coroutine") |
82 | ERRDEF(PRNGSD, "PRNG seeding failed") | ||
82 | ERRDEF(TABINS, "wrong number of arguments to " LUA_QL("insert")) | 83 | ERRDEF(TABINS, "wrong number of arguments to " LUA_QL("insert")) |
83 | ERRDEF(TABCAT, "invalid value (%s) at index %d in table for " LUA_QL("concat")) | 84 | ERRDEF(TABCAT, "invalid value (%s) at index %d in table for " LUA_QL("concat")) |
84 | ERRDEF(TABSORT, "invalid order function for sorting") | 85 | ERRDEF(TABSORT, "invalid order function for sorting") |