Correctness issue, particularly for Julia 1.12 - use after free bug#39
Correctness issue, particularly for Julia 1.12 - use after free bug#39asinghvi17 merged 7 commits intoJuliaGeo:masterfrom
Conversation
|
LGTM, thanks for testing and making a PR. The rest of the ecosystem has moved away from using For completeness sake, note that an alternative method is to use https://docs.julialang.org/en/v1/base/base/#Base.GC.@preserve. |
Indeed, and this is extremely useful if you need to work around this issue if you can't immediately upgrade your version of libspatialindex, because you can use |
|
Yes, feel free to close them, or I can when I'm back at my computer.
…On Fri, Dec 5, 2025, 7:45 PM Anshul Singhvi ***@***.***> wrote:
*asinghvi17* left a comment (JuliaGeo/LibSpatialIndex.jl#39)
<#39 (comment)>
Can #36 <#36> and #38
<#38> be closed / were
all of their changes incorporated in here?
—
Reply to this email directly, view it on GitHub
<#39 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEKNLRDIYBRBLBFRQIC6Q34AIRJJAVCNFSM6AAAAACKV3HO7SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMMJZGA3TMMJSGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
insert!,intersects, andknnall have code that looks something like this:The problem is that
pointeruses the vector it's passed implicitly, so does not prevent garbage collection of minvalues and maxvalues between when the pointer is created and when the C function is called. (see this and the last example in the first section here.This has probably been an issue for a long time, but it does seem at first unlikely that GC would happen to run in between allocation and use here - which is probably why it hasn't been noticed before. It seems changes in the garbage collection in Julia 1.12 make it much more likely that this will happen - I discovered it when this test started reliably failing on 1.12, specifically because this line started returning incorrect results because the correct values are not being inserted.
This builds on #36 and #38.