BUG/MEDIUM: quic: prevent crash due to CRYPTO parsing error
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 8 Nov 2024 11:40:29 +0000 (12:40 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 8 Nov 2024 14:19:57 +0000 (15:19 +0100)
commit2975e8805d9e84010bf5199a2365d650923dbb2c
treead4465dc57c44297d21c84ea208ed38962e5da3e
parent3ed936168842e8120940cf821843b876bd70dadf
BUG/MEDIUM: quic: prevent crash due to CRYPTO parsing error

A packet which contains several splitted and out of order CRYPTO frames
may be parsed multiple times to ensure it can be handled via ncbuf. Only
3 iterations can be performed to prevent excessive CPU usage.

There is a risk of crash if packet parsing is interrupted after maximum
iterations is reached, or no progress can be made on the ncbuf. This is
because <frm> may be dangling after list_for_each_entry_safe()

The crash occurs on qc_frm_free() invokation, on error path of
qc_parse_pkt_frms(). To fix it, always reset frm to NULL after
list_for_each_entry_safe() to ensure it is not dangling.

This should fix new report on github isue #2776. This regression has
been triggered by the following patch :
  1767196d5b2d8d1e557f7b3911a940000166ecda
  BUG/MINOR: quic: repeat packet parsing to deal with fragmented CRYPTO

As such, it must be backported up to 2.6, after the above patch.
src/quic_rx.c