This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 06b295c8fa7f4cbb060dc1a2024746c839959925
Author: Bryan Call <[email protected]>
AuthorDate: Tue Aug 20 09:02:45 2019 -0700

    HTTP/2 fix with realloc
    
    (cherry picked from commit b51c23e7b5174cb8f5a91fe72bd5f1eeb01e9ee4)
---
 proxy/http2/Http2ConnectionState.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index b300ae6..22027e8 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -865,8 +865,10 @@ rcv_continuation_frame(Http2ConnectionState &cstate, const 
Http2Frame &frame)
   uint32_t header_blocks_offset = stream->header_blocks_length;
   stream->header_blocks_length += payload_length;
 
-  stream->header_blocks = static_cast<uint8_t 
*>(ats_realloc(stream->header_blocks, stream->header_blocks_length));
-  frame.reader()->memcpy(stream->header_blocks + header_blocks_offset, 
payload_length);
+  if (stream->header_blocks_length > 0) {
+    stream->header_blocks = static_cast<uint8_t 
*>(ats_realloc(stream->header_blocks, stream->header_blocks_length));
+    frame.reader()->memcpy(stream->header_blocks + header_blocks_offset, 
payload_length);
+  }
 
   if (frame.header().flags & HTTP2_FLAGS_HEADERS_END_HEADERS) {
     // NOTE: If there are END_HEADERS flag, decode stored Header Blocks.

Reply via email to