fix: capture the return value of array_push in net_addr.cpp #11129
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes three functions in src/runtime/uv/net_addr.cpp that incorrectly called
array_push()without capturing its return value, violating the Lean runtime API contract. When arrays aren't exclusively owned or need reallocation,array_push()returns a new pointer, but the code continued using the old unmodified pointer, resulting in malformed IP addresses with zero-valued octets and failed network connections. The bug was masked in typical usage because arrays were usually exclusively owned with sufficient capacity, causing in-place modification. The fix changes all three functions to capture the return value(ret = array_push(ret, lean_box(octet))), and enhanced tests now validate that all IP address octets are properly populated. DNS resolution now returns correct addresses and all network operations succeed.Closes #11128