]> git.ipfire.org Git - thirdparty/systemd.git/commit
fuzz: limit the maximum size of test inputs for a few parsers 11975/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 12 Mar 2019 16:48:06 +0000 (17:48 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 12 Mar 2019 18:30:05 +0000 (19:30 +0100)
commit0fb729282b2a6bfbc3dd8580a3b1382daef280fa
tree92d172e252a2d4d1a786bcb20ecf2015ff5e079b
parent6d632d00eda5e505dc26cd202eba2c28b7d454b1
fuzz: limit the maximum size of test inputs for a few parsers

We have a few cases or reported issues which are about a timeout to parse
the input in 25 s. In all cases, the input is a few hundred kb. We don't really
care if the config parsers are super efficent, so let's set a limit on the input
size to avoid triggering such issues. The parsers often contain quadratic
algorithms. This is OK, because the numbers of elements are almost always very
small in real use. Rewriting the code to use more complicated data structures
to speed this up would not only complicate the code, but also pessimize behaviour
for the overwhelmingly common case of small samples. Note that in all those
cases, the input data is trusted. We care about memory correctness, and not
not so much about efficiency.

The size checks are done twice: using options for libfuzzer, and using an
internal check for afl. Those should be changed together. I didn't use a define,
because there is no easy mechanism to share the define between the two files.
src/fuzz/fuzz-env-file.c
src/fuzz/fuzz-env-file.options [new file with mode: 0644]
src/network/fuzz-network-parser.c
src/network/fuzz-network-parser.options [new file with mode: 0644]
src/udev/net/fuzz-link-parser.c
src/udev/net/fuzz-link-parser.options [new file with mode: 0644]