Commit ace7ab7
committed
BUG/MEDIUM: h3: properly reject unaligned non-DATA frames
HTTP/3 parser cannot deal with unaligned frames, except for DATA. As it
was expected that such case would not occur, a simple BUG_ON() was
written to protect HEADERS parsing.
First, this BUG_ON() was incorrectly written due an incorrect operator
'>=' vs '>' when checking if data wraps. Thus this patch correct it.
However, this is not resilient enough, as it still could happen that a
large HEADERS frame is unaligned, as HTTP/3 frame header (type + length)
is parsed first and removed, which may give some room at the buffer
beginning. If this small gap is filled the data will be unaligned.
Thus, this patch introduces a new check for non-DATA frames, prior to
the parsing functions. If data wraps, the parsing is interrupted and the
stream is closed with HTTP/3 error EXCESSIVE LOAD, similarly to a too
large frame.
This must be backported up to 2.6.1 parent 2901d0c commit ace7ab7
1 file changed
+21
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
| 644 | + | |
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
| |||
1142 | 1142 | | |
1143 | 1143 | | |
1144 | 1144 | | |
1145 | | - | |
| 1145 | + | |
1146 | 1146 | | |
1147 | 1147 | | |
1148 | 1148 | | |
| |||
1391 | 1391 | | |
1392 | 1392 | | |
1393 | 1393 | | |
1394 | | - | |
| 1394 | + | |
1395 | 1395 | | |
1396 | 1396 | | |
1397 | 1397 | | |
| |||
1818 | 1818 | | |
1819 | 1819 | | |
1820 | 1820 | | |
1821 | | - | |
1822 | | - | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
1823 | 1824 | | |
1824 | | - | |
| 1825 | + | |
1825 | 1826 | | |
1826 | 1827 | | |
1827 | 1828 | | |
| |||
1834 | 1835 | | |
1835 | 1836 | | |
1836 | 1837 | | |
1837 | | - | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
1838 | 1852 | | |
1839 | 1853 | | |
1840 | 1854 | | |
| |||
0 commit comments