This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/10.0.x by this push:
new ee722c6ea3 Add nullptr check in PluginVC read and write (#11961)
ee722c6ea3 is described below
commit ee722c6ea30d18a6adc7e605464850df94db33e0
Author: Masaori Koshiba <[email protected]>
AuthorDate: Fri Jan 17 08:26:10 2025 +0900
Add nullptr check in PluginVC read and write (#11961)
(cherry picked from commit 28c8105687c9b883c2eee8b3357af322fe52ff4e)
---
src/proxy/PluginVC.cc | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/proxy/PluginVC.cc b/src/proxy/PluginVC.cc
index f801895cd2..213c0d05e5 100644
--- a/src/proxy/PluginVC.cc
+++ b/src/proxy/PluginVC.cc
@@ -483,7 +483,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;
}
@@ -493,9 +493,13 @@ PluginVC::process_write_side()
return;
}
- IOBufferReader *reader = write_state.vio.get_reader();
- int64_t bytes_avail = reader->read_avail();
- int64_t act_on = std::min(bytes_avail, ntodo);
+ IOBufferReader *reader = write_state.vio.get_reader();
+ if (reader == nullptr) {
+ return;
+ }
+
+ int64_t bytes_avail = reader->read_avail();
+ int64_t act_on = std::min(bytes_avail, ntodo);
Dbg(dbg_ctl_pvc, "[%u] %s: process_write_side; act_on %" PRId64 "",
core_obj->id, PVC_TYPE, act_on);
@@ -601,7 +605,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;
}