From a12bccaafc97e6dc8692024b63575b5cc4e79ebc Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Fri, 18 Sep 2026 01:26:08 +0300 Subject: [PATCH] normalize negative pool size --- CHANGELOG.md | 2 +- plugins/jsvm/pool.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95514b39..93c267ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - Updated `modernc.org/sqlite` to 1.59.0 _(minor performance improvement by switching to Go's `memmove`)_. -- Other minor changes (godoc typos). +- Other minor fixes (godoc typos, normalize negative jsvm pool size, etc.). ## v0.40.4 diff --git a/plugins/jsvm/pool.go b/plugins/jsvm/pool.go index e0174c5e..e330609e 100644 --- a/plugins/jsvm/pool.go +++ b/plugins/jsvm/pool.go @@ -20,6 +20,10 @@ type vmsPool struct { // newPool creates a new pool with pre-warmed vms generated from the specified factory. func newPool(size int, factory func() *goja.Runtime) *vmsPool { + if size < 0 { + size = 0 + } + pool := &vmsPool{ factory: factory, items: make([]*poolItem, size),