From c91745e3a47f8f44dd45409e67a2c65bc2b3f295 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 24 Oct 2024 09:50:15 +0200 Subject: [PATCH] BUG/MINOR: mux-h1: Fix conditions on pipe in some COUNT_IF() The previous commit contains a bug in some COUNT_IF() relying on the pipe inside the IOBUF. We must take care to have a pipe before checking its size. No backport needed. --- src/mux_h1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mux_h1.c b/src/mux_h1.c index ccdf3cdfa..c87849d0f 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -4909,7 +4909,7 @@ static size_t h1_done_ff(struct stconn *sc) */ h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event); } - COUNT_IF(b_data(&h1c->obuf) || sd->iobuf.pipe->data, "connection error (done_ff) with pending output data"); + COUNT_IF(b_data(&h1c->obuf) || (sd->iobuf.pipe && sd->iobuf.pipe->data), "connection error (done_ff) with pending output data"); se_fl_set_error(h1s->sd); if (sd->iobuf.pipe) { put_pipe(sd->iobuf.pipe); @@ -5089,7 +5089,7 @@ static int h1_fastfwd(struct stconn *sc, unsigned int count, unsigned int flags) se_fl_set(h1s->sd, SE_FL_ERROR); h1c->flags = (h1c->flags & ~H1C_F_WANT_FASTFWD) | H1C_F_ERROR; COUNT_IF(h1m->state < H1_MSG_DONE, "H1C ERROR before the end of the message"); - COUNT_IF(b_data(&h1c->obuf) || h1s->sd->iobuf.pipe->data, "connection error (fastfwd) with pending output data"); + COUNT_IF(b_data(&h1c->obuf) || (h1s->sd->iobuf.pipe && h1s->sd->iobuf.pipe->data), "connection error (fastfwd) with pending output data"); TRACE_DEVEL("connection error", H1_EV_STRM_ERR|H1_EV_H1C_ERR|H1_EV_H1S_ERR, h1c->conn, h1s); } @@ -5171,7 +5171,7 @@ static int h1_resume_fastfwd(struct stconn *sc, unsigned int flags) h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event); } se_fl_set_error(h1s->sd); - COUNT_IF(b_data(&h1c->obuf) || h1s->sd->iobuf.pipe->data, "connection error (resume_ff) with pending output data"); + COUNT_IF(b_data(&h1c->obuf) || (h1s->sd->iobuf.pipe && h1s->sd->iobuf.pipe->data), "connection error (resume_ff) with pending output data"); if (h1s->sd->iobuf.pipe) { put_pipe(h1s->sd->iobuf.pipe); h1s->sd->iobuf.pipe = NULL;