Bug 572251 - tcf exception during handle long message
diff --git a/agent/tcf/framework/inputbuf.c b/agent/tcf/framework/inputbuf.c
index d59ab79..3901e99 100644
--- a/agent/tcf/framework/inputbuf.c
+++ b/agent/tcf/framework/inputbuf.c
@@ -84,10 +84,12 @@
assert(out >= ibuf->buf && out <= ibuf->buf + ibuf->buf_size);
assert(out == inp->end);
for (;;) {
+ if (out == ibuf->buf + ibuf->buf_size) out = ibuf->buf;
if (out == ibuf->inp) {
/* No data available */
assert(ibuf->long_msg || ibuf->eof);
- inp->cur = inp->end = ibuf->inp = ibuf->buf;
+ /* Note: async read may be running, don't change ibuf->inp */
+ inp->cur = inp->end = out;
if (ibuf->eof) return MARKER_EOS;
assert(ibuf->message_count == 1);
ibuf_trigger_read(ibuf);
@@ -97,7 +99,6 @@
}
/* Data available */
- if (out == ibuf->buf + ibuf->buf_size) out = ibuf->buf;
ch = *out;
#if ENABLE_ZeroCopy