ext/sockets: various memory related fixes#22794
Open
devnexen wants to merge 5 commits into
Open
Conversation
…-free on the Windows address table. GetIpAddrTable() was retried against addr_table after an erealloc() whose return value was discarded, so on ERROR_INSUFFICIENT_BUFFER it wrote into the freed block. Assign the reallocated pointer back before retrying.
socket_import_file_descriptor() sets bsd_socket before zstream is copied, so a failing import freed the object with zstream still UNDEF and closed the fd still owned by the stream. Invalidate bsd_socket on the error path.
The cbpf/bpfprog buffers were function-local statics shared across threads, so concurrent SO_ATTACH_REUSEPORT_CBPF calls could install a torn filter. Move them to function scope so they outlive the block up to setsockopt() without being shared.
The generic path only corrected 1-byte options; an option returning 0/2/3 bytes left the high bytes of other_val uninitialized before RETURN_LONG. Zero-initialize it before getsockopt().
The error was recorded but execution fell through to array_init_size() and the loop with a truncated length. Return right after reporting it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.