This is an automated email from the ASF dual-hosted git repository.
masaori pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 28c8105687 Add nullptr check in PluginVC read and write (#11961)
28c8105687 is described below
commit 28c8105687c9b883c2eee8b3357af322fe52ff4e
Author: Masaori Koshiba <[email protected]>
AuthorDate: Fri Jan 17 08:26:10 2025 +0900
Add nullptr check in PluginVC read and write (#11961)
---
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 b9ca711a4e..427b271eba 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;
}