Skip to content

Fix use-after-free when forcibly reloading the luv module#821

Merged
squeek502 merged 1 commit intoluvit:masterfrom
squeek502:loop-gc-null
Mar 30, 2026
Merged

Fix use-after-free when forcibly reloading the luv module#821
squeek502 merged 1 commit intoluvit:masterfrom
squeek502:loop-gc-null

Conversation

@squeek502
Copy link
Copy Markdown
Member

Closes #819

I was still not able to reproduce the bug with garbage collection alone, but this also fixes a modified version of the reproduction with an explicit loop_close:

local uv = require "luv"

local timer = uv.new_timer()
timer:start(100, 0, function() timer:close() end)
uv.run()

package.loaded["luv"] = nil
-- forcibly close the loop
uv.loop_close()

-- Step 3: Re-require and use → SEGFAULT (previously)
local uv2 = require "luv"
local timer2 = uv2.new_timer()  -- no segfault here :)

@squeek502 squeek502 mentioned this pull request Mar 30, 2026
@squeek502 squeek502 merged commit a9f2e5d into luvit:master Mar 30, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segfault in lua5.5

2 participants