You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2020/10/14 15:30:49 UTC

[qpid-dispatch] branch dev-protocol-adaptors-2 updated: NO-JIRA: Assert offset vs. body_data_buffer_count only when offset nonzero.

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

chug pushed a commit to branch dev-protocol-adaptors-2
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/dev-protocol-adaptors-2 by this push:
     new e9b5dc7  NO-JIRA: Assert offset vs. body_data_buffer_count only when offset nonzero.
e9b5dc7 is described below

commit e9b5dc7551e79a8163f00a2bcabeb0ea421868db
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Wed Oct 14 11:27:11 2020 -0400

    NO-JIRA: Assert offset vs. body_data_buffer_count only when offset nonzero.
    
    Prevents offset=0 and buffer_count=0 asserts.
---
 src/message.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/message.c b/src/message.c
index 2894086..9d3c5c5 100644
--- a/src/message.c
+++ b/src/message.c
@@ -2435,12 +2435,14 @@ int qd_message_body_data_buffers(qd_message_body_data_t *body_data, pn_raw_buffe
     //
     // Skip the buffer offset
     //
-    assert(offset < qd_message_body_data_buffer_count(body_data));
-    while (offset > 0 && payload_len > 0) {
-        payload_len -= qd_buffer_size(buffer) - data_offset;
-        offset--;
-        data_offset = 0;
-        buffer = DEQ_NEXT(buffer);
+    if (offset > 0) {
+        assert(offset < qd_message_body_data_buffer_count(body_data));
+        while (offset > 0 && payload_len > 0) {
+            payload_len -= qd_buffer_size(buffer) - data_offset;
+            offset--;
+            data_offset = 0;
+            buffer = DEQ_NEXT(buffer);
+        }
     }
 
     //


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org