This is an automated email from the ASF dual-hosted git repository.
eze pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new c85e07862b Add nullptr check in PluginVC read and write (#11961)
(#11972)
c85e07862b is described below
commit c85e07862b5bf0a155b4edf7df1e3d84bf232f13
Author: Evan Zelkowitz <[email protected]>
AuthorDate: Fri Jan 17 10:12:38 2025 -0700
Add nullptr check in PluginVC read and write (#11961) (#11972)
(cherry picked from commit 28c8105687c9b883c2eee8b3357af322fe52ff4e)
Co-authored-by: Masaori Koshiba <[email protected]>
---
proxy/PluginVC.cc | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc
index dcaffe9d0e..694614cea4 100644
--- a/proxy/PluginVC.cc
+++ b/proxy/PluginVC.cc
@@ -476,7 +476,7 @@ PluginVC::process_write_side()
need_write_process = false;
// Check write_state
- if (write_state.vio.op != VIO::WRITE || closed || write_state.shutdown) {
+ if (write_state.vio.cont == nullptr || write_state.vio.op != VIO::WRITE ||
closed || write_state.shutdown) {
return;
}
@@ -487,8 +487,12 @@ PluginVC::process_write_side()
}
IOBufferReader *reader = write_state.vio.get_reader();
- int64_t bytes_avail = reader->read_avail();
- int64_t act_on = std::min(bytes_avail, ntodo);
+ if (reader == nullptr) {
+ return;
+ }
+
+ int64_t bytes_avail = reader->read_avail();
+ int64_t act_on = std::min(bytes_avail, ntodo);
Debug("pvc", "[%u] %s: process_write_side; act_on %" PRId64 "",
core_obj->id, PVC_TYPE, act_on);
@@ -594,7 +598,8 @@ PluginVC::process_read_side()
need_read_process = false;
// Check read_state
- if (read_state.vio.op != VIO::READ || closed || read_state.shutdown ||
!read_state.vio.ntodo()) {
+ if (read_state.vio.cont == nullptr || read_state.vio.op != VIO::READ ||
closed || read_state.shutdown ||
+ !read_state.vio.ntodo()) {
return;
}