kgiusti commented on a change in pull request #1248:
URL: https://github.com/apache/qpid-dispatch/pull/1248#discussion_r658928590



##########
File path: src/adaptors/http2/http2_adaptor.c
##########
@@ -576,25 +609,27 @@ static int snd_data_callback(nghttp2_session *session,
         memcpy(qd_http2_buffer_cursor(http2_buff), framehd, 
HTTP2_DATA_FRAME_HEADER_LENGTH);
         qd_http2_buffer_insert(http2_buff, HTTP2_DATA_FRAME_HEADER_LENGTH);
         pn_raw_buffer_t pn_raw_buffs[stream_data->qd_buffers_to_send];
-        qd_message_stream_data_buffers(stream_data->curr_stream_data, 
pn_raw_buffs, 0, stream_data->qd_buffers_to_send);
+        qd_message_stream_data_buffers(stream_data->curr_stream_data, 
pn_raw_buffs, stream_data->curr_stream_data_qd_buff_offset, 
stream_data->qd_buffers_to_send);
 
         int idx = 0;
+        size_t bytes_to_send = length;
         while (idx < stream_data->qd_buffers_to_send) {
             if (pn_raw_buffs[idx].size > 0) {
-                //int bytes_remaining = length - bytes_sent;
-                //if (bytes_remaining > pn_raw_buffs[idx].size) {
+               if (bytes_to_send < pn_raw_buffs[idx].size) {
+                       memcpy(qd_http2_buffer_cursor(http2_buff), 
pn_raw_buffs[idx].bytes + stream_data->curr_stream_data_offset, bytes_to_send);

Review comment:
       Q: can this loop overrun the space available in http2_buff?   Where is 
the remaining capacity of http2_buff tracked?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to