DescriptionVM: Fix segfault during shutdown of socket listening registry
The following happened:
A listening socket (ipv4, first-port) was created. Afterwards another
listening socket (ipv6, 0) is being created. We look up in the hashmap
if there is already a listening socket on port `0` (which is never the case).
So we create a new socket, the OS assigns the socket a random port
(which just happens to be `first-port` as well). Then we insert a new OSSocket
entry into the hashmap with key `first-port` (and set its `next` field to NULL).
This will simply override the existing entry.
During shutdown we loop over all (fd, OSSocket) pairs and try to remove
`OSSocket` from the port->socket map (via the linked `next` list). We cannot
find the `OSSocket` which we accidentally droped earlier, so we dereference
`0->next` and hit a SEGFAULT.
What should've happend is to correctly link the `OSSocket`s via the next field.
Fixes #27847
R=asiva@google.com, fschneider@google.com
Committed: https://github.com/dart-lang/sdk/commit/f9c9c4e767e4b9538cf6e76e7327b7683235a06e
Patch Set 1 #
Total comments: 4
Patch Set 2 : addressed comments #Messages
Total messages: 11 (5 generated)
|