trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mas...@apache.org
Subject [trafficserver] branch quic-latest updated: Fix a bug that data on streams can be corrupted
Date Fri, 01 Dec 2017 06:29:48 GMT
This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
     new 437bb7c  Fix a bug that data on streams can be corrupted
437bb7c is described below

commit 437bb7c5574037ef52d912e649933ae90fdc2dab
Author: Masakazu Kitajo <maskit@apache.org>
AuthorDate: Fri Dec 1 15:28:43 2017 +0900

    Fix a bug that data on streams can be corrupted
---
 iocore/net/quic/QUICIncomingFrameBuffer.cc | 11 +++++++++--
 iocore/net/quic/QUICIncomingFrameBuffer.h  |  4 ++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/iocore/net/quic/QUICIncomingFrameBuffer.cc b/iocore/net/quic/QUICIncomingFrameBuffer.cc
index 797b7b9..8975bc6 100644
--- a/iocore/net/quic/QUICIncomingFrameBuffer.cc
+++ b/iocore/net/quic/QUICIncomingFrameBuffer.cc
@@ -69,9 +69,9 @@ QUICIncomingFrameBuffer::insert(const std::shared_ptr<const QUICStreamFrame>
fra
     return QUICErrorUPtr(new QUICNoError());
   } else if (this->_recv_offset == offset) {
     this->_recv_offset = offset + len;
-    this->_recv_buffer.push(frame);
+    this->_recv_buffer.push(this->_clone(frame));
   } else {
-    this->_out_of_order_queue.insert(std::make_pair(offset, frame));
+    this->_out_of_order_queue.insert(std::make_pair(offset, this->_clone(frame)));
   }
 
   return QUICErrorUPtr(new QUICNoError());
@@ -97,6 +97,13 @@ QUICIncomingFrameBuffer::empty()
   return this->_out_of_order_queue.empty() && this->_recv_buffer.empty();
 }
 
+std::shared_ptr<const QUICStreamFrame>
+QUICIncomingFrameBuffer::_clone(std::shared_ptr<const QUICStreamFrame> frame)
+{
+  return QUICFrameFactory::create_stream_frame(frame->data(), frame->data_length(),
frame->stream_id(), frame->offset(),
+                                               frame->has_fin_flag());
+}
+
 QUICErrorUPtr
 QUICIncomingFrameBuffer::_check_and_set_fin_flag(QUICOffset offset, size_t len, bool fin_flag)
 {
diff --git a/iocore/net/quic/QUICIncomingFrameBuffer.h b/iocore/net/quic/QUICIncomingFrameBuffer.h
index 66b637a..5ecfb6e 100644
--- a/iocore/net/quic/QUICIncomingFrameBuffer.h
+++ b/iocore/net/quic/QUICIncomingFrameBuffer.h
@@ -37,6 +37,9 @@ public:
 
   std::shared_ptr<const QUICStreamFrame> pop();
 
+  /*
+   * Becasue frames passed by FrameDispatcher is temporal, this clones a passed frame to
ensure that we can use it later.
+   */
   QUICErrorUPtr insert(const std::shared_ptr<const QUICStreamFrame>);
 
   void clear();
@@ -48,6 +51,7 @@ private:
   QUICOffset _max_offset  = 0;
   QUICOffset _fin_offset  = UINT64_MAX;
 
+  std::shared_ptr<const QUICStreamFrame> _clone(std::shared_ptr<const QUICStreamFrame>
frame);
   QUICErrorUPtr _check_and_set_fin_flag(QUICOffset offset, size_t len = 0, bool fin_flag
= false);
 
   std::queue<std::shared_ptr<const QUICStreamFrame>> _recv_buffer;

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message