Skip to content

Write to freed memory area with IoCompletionPort (IOCP) ioqueue backend may lead to application crash #985

@pjsipbot

Description

@pjsipbot

2009-11-05 13:40:55: @bennylp created the issue on trac ticket 985

Using IoCompletionPort (IOCP) ioqueue backend, which is the default backend on Win32 on Release build, may lead to write access to memory area that has been freed before. This potentially could crash the application, or random memory corruption.

This symptom can be detected with Visual Studio 2005 (but not with Visual Studio 6).

Explanation about this bug is as follows.

  1. When socket is closed, Windows automatically unregisters the socket from the IOCP. Any pending operations to the socket are also cancelled.
  2. But when the next time the IOCP is polled with GetQueuedCompletionStatus(), Windows would still report an event to the pending operations that have been cancelled above.
  3. If the memory that corresponds to the WSAOVERLAPPED structure that was registered for the asynchronous operation has been freed (for example, the pool is released), Windows will write some values to these area that was previously occupied by the WSAOVERLAPPED structure.

2010-02-25 11:54:47: @bennylp changed milestone from release-1.6 to release-1.7


2010-04-28 01:16:16: @bennylp changed status from new to closed


2010-04-28 01:16:16: @bennylp set resolution to worksforme


2010-04-28 01:16:16: @bennylp changed milestone from release-1.7 to release-1.5.5


2010-04-28 01:16:16: @bennylp commented

Turns out this has been "fixed" in milestone:release-1.6 by ticket #1015, by disabling IOCP backend altogether.

Changing the milestone to 1.5.5 and closing the ticket.


2010-04-28 01:16:52: @bennylp commented

(The above should read milestone:release-1.5.5 instead of 1.6).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions