mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-06 11:28:00 +00:00
haproxy public development tree
Issue 22689 in oss-fuzz shows that specially crafted config files can take a long time to process. This happens when variable expansion, backslash escaping or unquoting causes calls to memmove() and possibly to realloc() resulting in O(N^2) complexity with N following the line size. By using parse_line() we now have a safe parser that remains in O(N) regardless of the type of operation. Error reporting changed a little bit since the errors are not reported anymore from the deepest parsing level. As such we now report the beginning of the error. One benefit is that for many invalid character sequences, the original line is shown and the first bad char or sequence is designated with a caret ('^'), which tends to be visually easier to spot, for example: [ALERT] 167/170507 (14633) : parsing [mini5.cfg:19]: unmatched brace in environment variable name below: "${VAR"} ^ or: [ALERT] 167/170645 (14640) : parsing [mini5.cfg:18]: unmatched quote below: timeout client 10s' ^ In case the target buffer is too short for the new line, the output buffer is grown in 1kB chunks and kept till the end, so that it should not happen too often. Before this patch a test like below involving a 4 MB long line would take 138s to process, 98% of which were spent in __memmove_avx_unaligned_erms(), and now it takes only 65 milliseconds: $ perl -e 'print "\"\$A\""x1000000,"\n"' | ./haproxy -c -f /dev/stdin 2>/dev/null This may be backported to stable versions after a long period of observation to be sure nothing broke. It relies on patch "MINOR: tools: add a new configurable line parse, parse_line()". |
||
---|---|---|
.github | ||
contrib | ||
doc | ||
examples | ||
include | ||
reg-tests | ||
scripts | ||
src | ||
tests | ||
.cirrus.yml | ||
.gitignore | ||
.travis.yml | ||
BRANCHES | ||
CHANGELOG | ||
CONTRIBUTING | ||
INSTALL | ||
LICENSE | ||
MAINTAINERS | ||
Makefile | ||
README | ||
ROADMAP | ||
SUBVERS | ||
VERDATE | ||
VERSION |
The HAProxy documentation has been split into a number of different files for ease of use. Please refer to the following files depending on what you're looking for : - INSTALL for instructions on how to build and install HAProxy - BRANCHES to understand the project's life cycle and what version to use - LICENSE for the project's license - CONTRIBUTING for the process to follow to submit contributions The more detailed documentation is located into the doc/ directory : - doc/intro.txt for a quick introduction on HAProxy - doc/configuration.txt for the configuration's reference manual - doc/lua.txt for the Lua's reference manual - doc/SPOE.txt for how to use the SPOE engine - doc/network-namespaces.txt for how to use network namespaces under Linux - doc/management.txt for the management guide - doc/regression-testing.txt for how to use the regression testing suite - doc/peers.txt for the peers protocol reference - doc/coding-style.txt for how to adopt HAProxy's coding style - doc/internals for developer-specific documentation (not all up to date)