9.2.x: INKVConnInternal::do_io_*: handle null buffer#13413
Open
bneradt wants to merge 1 commit into
Open
Conversation
It's common for users of VC's to cancel io via a 0 byte, nullptr read or write on the VC. INKVConnInternal::do_io_read and INKVConnInternal::do_io_write were not prepared to handle such cancellations. This updates them to handle this gracefully rather than crashing on a nullptr dereference. This change is was found to be needed for the multiplexer plugin for handling HttpTunnel aborts. For reference, see, for example, UnixNetVConnection::do_io_read which handles a nullptr MIOBuffer. This basically copies that logic into INKVConnInternal so it handles cancellation gracefully. (cherry picked from commit 7afd9e3)
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the internal SDK VConnection implementation (INKVConnInternal) to safely handle common I/O cancellation patterns where plugins call do_io_read / do_io_write with nbytes == 0 and a null buffer/reader. This aligns behavior more closely with established NetVC handling (e.g., UnixNetVConnection) by avoiding null dereferences during cancellation flows (notably for HttpTunnel abort handling in the multiplexer plugin).
Changes:
- Guard
INKVConnInternal::do_io_readagainst nullMIOBuffer*by clearing the VIO buffer accessor instead of dereferencing. - Guard
INKVConnInternal::do_io_writeagainst nullIOBufferReader*by clearing the VIO buffer accessor instead of dereferencing. - Only schedule an immediate event when a non-null buffer/reader is provided (and, for writes, when there is data available).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ezelkow1
approved these changes
Jul 21, 2026
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.
It's common for users of VC's to cancel io via a 0 byte, nullptr read or
write on the VC. INKVConnInternal::do_io_read and
INKVConnInternal::do_io_write were not prepared to handle such
cancellations. This updates them to handle this gracefully rather than
crashing on a nullptr dereference. This change is was found to be needed
for the multiplexer plugin for handling HttpTunnel aborts.
For reference, see, for example, UnixNetVConnection::do_io_read which
handles a nullptr MIOBuffer. This basically copies that logic into
INKVConnInternal so it handles cancellation gracefully.
(cherry picked from commit 7afd9e3)