]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: h3: close connection on sending alloc errors
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 22 Dec 2023 08:00:13 +0000 (09:00 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 22 Dec 2023 15:02:49 +0000 (16:02 +0100)
commit2144d2418651c1f76b91cc1f6e745feecdefcb00
tree8cf05d4fa32a3f3ed3e40c6eec0fd1c33f865e9e
parentd077f7ccf48424fa40eea29c69283ec23732c96d
BUG/MINOR: h3: close connection on sending alloc errors

When encoding new HTTP/3 frames, QCS Tx buffer must be allocated if
currently NULL. Previously, allocation failure was not properly checked,
leaving the connection in an unspecified state, or worse risking a
crash.

Fix this by setting <h3c.err> to H3_INTERNAL_ERROR each time the
allocation fails. This will stop sending and close the connection. In
the future, it may be better to put the connection on pause waiting for
allocation to succeed but this is too complicated to implement for now
in a reliable way.

Along with the current change, return of all HTX parsing functions
(h3_resp_*_send) were set to a negative value in case of error. A new
BUG_ON() in h3_snd_buf() ensures that if such a value is returned,
either a connection error is register (via <h3c.err>) or buffer is
temporarily full (flag QC_SF_BLK_MROOM).

This should fix github issue #2389.

This should be backported up to 2.6. Note that qcc_get_stream_txbuf()
does not exist in 2.9 and below. mux_get_buf() is its equivalent. An
explicit check b_is_null(&qcs.tx.buf) should be used there.
src/h3.c