mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 21:43:40 +00:00
runtime: call initRand() before initHeap() during initialization.
The reason is that allocating without a heap is usually more visible than using an uninitialized random generator which is subtle and may lead to security vulnerabilities. Based on suggestion from @eliasnaur Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
@@ -34,8 +34,8 @@ func wasmEntryReactor() {
|
||||
// Initialize the heap.
|
||||
heapStart = uintptr(unsafe.Pointer(&heapStartSymbol))
|
||||
heapEnd = uintptr(wasm_memory_size(0) * wasmPageSize)
|
||||
initHeap()
|
||||
initRand()
|
||||
initHeap()
|
||||
|
||||
if hasScheduler {
|
||||
// A package initializer might do funky stuff like start a goroutine and
|
||||
|
||||
Reference in New Issue
Block a user