Skip to content

fix use-after-free in loadAsNative - #29

Open
180watt wants to merge 1 commit into
BowDown097:masterfrom
180watt:master
Open

fix use-after-free in loadAsNative#29
180watt wants to merge 1 commit into
BowDown097:masterfrom
180watt:master

Conversation

@180watt

@180watt 180watt commented Jul 25, 2026

Copy link
Copy Markdown

This fixes a use-after-free in loadAsNative that crashes the program on FreeBSD 15.1.

This is just a matter of the unique_ptr calling the destructor at the end of loadAsNative's scope and there still being references to it later in the code. My debugging skills are not great, so I don't see exactly where it's going wrong, just that it is.

Perhaps not the most elegant fix (I mainly do C), there will be no hard feelings if you need to clean it up.

Here is the ASAN report that tipped me off to the nature of the bug.
ASAN-Report.txt

--
Best,
180watt

@BowDown097

BowDown097 commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR! I wonder why this happens on BSD and not Linux or Windows 🤔
I do believe this has already been fixed in the 1.3 branch, see the NativePluginEntry class there. That release should be coming very soon. I'll keep this PR open for the time being though, in the case that it somehow hasn't been fixed.

@180watt

180watt commented Jul 27, 2026

Copy link
Copy Markdown
Author

Most likely an implementation difference between GNU and FreeBSD's ld-elf. I didn't see that there was different branch, I would of just built that. Sorry for the noise with the pull request.

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.

2 participants