Skip to content

Commit

Permalink
oss-fuzz: reject giant configs early
Browse files Browse the repository at this point in the history
It should help the fuzzer to avoid running into timeouts
like https://oss-fuzz.com/testcase-detail/5132999948632064.
Hopefully, once this is merged OSS-Fuzz will report only
infinite loops as timeouts.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
  • Loading branch information
evverx authored and Christian Brauner committed Apr 2, 2021
1 parent 52c5788 commit 2f59375
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/tests/fuzz-lxc-config-read.c
Expand Up @@ -13,6 +13,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
char tmpf[] = "/tmp/fuzz-lxc-config-read-XXXXXX";
struct lxc_conf *conf = NULL;

/*
* 100Kb should probably be enough to trigger all the issues
* we're interested in without any timeouts
*/
if (size > 102400)
return 0;

fd = lxc_make_tmpfile(tmpf, false);
lxc_test_assert_abort(fd >= 0);
lxc_write_nointr(fd, data, size);
Expand Down

0 comments on commit 2f59375

Please sign in to comment.