BUG/MINOR: quic: Missing STREAM frame type updated
This patch follows this commit which was not sufficient:
BUG/MINOR: quic: Missing STREAM frame data pointer updates
Indeed, after updating the ->offset field, the bit which informs the
frame builder of its presence must be systematically set.
This bug was revealed by the following BUG_ON() from
quic_build_stream_frame() :
bug condition "!!(frm->type & 0x04) != !!stream->offset.key" matched at src/quic_frame.c:515
This should fix the last crash occured on github issue #2074.
Must be backported to 2.6 and 2.7.
diff --git a/include/haproxy/quic_frame.h b/include/haproxy/quic_frame.h
index f75d7e6..cf489f7 100644
--- a/include/haproxy/quic_frame.h
+++ b/include/haproxy/quic_frame.h
@@ -255,11 +255,15 @@
}
/* Move forward <strm> STREAM frame by <data> bytes. */
-static inline void qc_stream_frm_mv_fwd(struct quic_stream *strm, uint64_t data)
+static inline void qc_stream_frm_mv_fwd(struct quic_frame *frm, uint64_t data)
{
+ struct quic_stream *strm = &frm->stream;
struct buffer cf_buf;
+ /* Set offset bit if not already there. */
strm->offset.key += data;
+ frm->type |= QUIC_STREAM_FRAME_TYPE_OFF_BIT;
+
strm->len -= data;
cf_buf = b_make(b_orig(strm->buf),
b_size(strm->buf),
diff --git a/src/quic_conn.c b/src/quic_conn.c
index f4a36f0..25ece80 100644
--- a/src/quic_conn.c
+++ b/src/quic_conn.c
@@ -1905,7 +1905,7 @@
else if (strm_frm->offset.key < stream_desc->ack_offset) {
uint64_t diff = stream_desc->ack_offset - strm_frm->offset.key;
- qc_stream_frm_mv_fwd(strm_frm, diff);
+ qc_stream_frm_mv_fwd(frm, diff);
TRACE_DEVEL("updated partially acked frame",
QUIC_EV_CONN_PRSAFRM, qc, frm);
}
@@ -2562,7 +2562,7 @@
else if (strm_frm->offset.key < stream_desc->ack_offset) {
uint64_t diff = stream_desc->ack_offset - strm_frm->offset.key;
- qc_stream_frm_mv_fwd(strm_frm, diff);
+ qc_stream_frm_mv_fwd(frm, diff);
TRACE_DEVEL("updated partially acked frame",
QUIC_EV_CONN_PRSAFRM, qc, frm);
}
@@ -7301,7 +7301,7 @@
else if (strm->offset.key < stream_desc->ack_offset) {
uint64_t diff = stream_desc->ack_offset - strm->offset.key;
- qc_stream_frm_mv_fwd(strm, diff);
+ qc_stream_frm_mv_fwd(cf, diff);
TRACE_DEVEL("updated partially acked frame",
QUIC_EV_CONN_PRSAFRM, qc, cf);
}