-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fix stale reference bug in std.zig.system.resolveTargetQuery
#25713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Actually, now that I look at this a bit closer... there is indeed a stack UAF bug here, but I think the solution isn't to heap-allocate; rather, I think we should just throw away any non-
|
Instead of duplicating the prerelease and build components, we now ignore them altogether. This is implemented in Target.Query.parseVersion, which now additionally discards the prerelease and build components.
78ed81b to
f2f5a20
Compare
This was removed while implementing the ignoring of prerelease and build components, but currently it is incorrect to leave out
…tut/zig into target-resolve-safety-patch
Now the test ensures that the function returns an error rather than discarding the components
Co-authored-by: Alex Rønne Petersen <[email protected]>
…ng#25713) Co-authored-by: Alex Rønne Petersen <[email protected]>
When
std.zig.resolveTargetQuerydetects the native OS version, anySemanticVersioncontained in the return value would use a stack buffer for the "pre" and "build" fields. This would result in a stale reference being returned from the function. To remedy this, an additional allocator parameter was added to the function.