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:
deadprogram
2025-12-18 16:26:56 +01:00
committed by Ron Evans
parent 0e540dc3da
commit 82deccac40
5 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -243,8 +243,8 @@ func sleep(duration int64) {
// run is called by the program entry point to execute the go program.
// With a scheduler, init and the main function are invoked in a goroutine before starting the scheduler.
func run() {
initHeap()
initRand()
initHeap()
go func() {
initAll()
callMain()