Commit Graph

11 Commits

Author SHA1 Message Date
Jonathan Neuschäfer
c2f9244137 test/fuzz: Fix use of htons vs. ntohs
Although ntohs and htons perform equivalent operations (a byte swap on
little-endian platforms), their semantic roles (as implied by the names)
are different.

In fuzz_common.c, we get integers from simulated network packages, and
convert them for host CPU use, so ntohs is the right variant to use.
2023-05-11 22:10:32 +02:00
Jonathan Neuschäfer
e8b0324f81 test/fuzz: Don't crash with assertion failure when a packet is too big
A fuzzer may generate big packets, and it will interpret assertion
failures as bugs. Instead of asserting that the packet size is
reasonable, simply skip the packet when it's not the case.
2023-04-07 22:25:50 +02:00
Wouter van Gulik
5ab46f82f9 Fix failing fuzzer if compiling with ubsan
See patch #10163

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2021-12-30 22:04:23 +01:00
Erik Ekman
9b1056ef0e fuzz: Fix compile error in simulated glibc rand
When using LWIP_RAND_FOR_FUZZ_SIMULATE_GLIBC:

fuzz_common.c: In function ‘lwip_fuzz_rand’:
fuzz_common.c:683:11: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
  683 |   if (idx >= sizeof(rand_nrs)/sizeof((rand_nrs)[0])) {
      |           ^~
cc1: all warnings being treated as errors
2020-06-19 13:26:58 +02:00
Simon Goldschmidt
e30d50710d fuzz: allow overriding LWIP_RAND for fuzz tests
Fuzz tests need reproducible code, so we need an "unsafe" version of
LWIP_RAND() in this case...

Also, to reproduce fuzz tests cases from Linux on Windows,
LWIP_RAND_FOR_FUZZ_SIMULATE_GLIBC provides the first 20 random numbers that
glibc would have...
2020-03-27 22:42:06 +01:00
Simon Goldschmidt
003f5cc12d fuzz: whitespace fixes 2020-03-09 21:50:50 +01:00
Simon Goldschmidt
412c8d1902 fuzz: fix compiler error "missing prototype" 2020-03-08 20:41:53 +01:00
Simon Goldschmidt
a02f34a193 fuzz: add pcap output to help debugging fuzz crashes 2020-03-05 21:00:00 +01:00
Simon Goldschmidt
a9052caf10 fuzz: add debug output to help debugging fuzz crashes 2020-03-05 20:49:41 +01:00
Simon Goldschmidt
d05be56a50 fuzz: add more fuzz tests
From: Hiromasa Ito <v3hertz@gmail.com>

See bugs #57374-#57380 found by this new test mode.
2020-02-20 21:55:13 +01:00
Simon Goldschmidt
a07e0a82c9 test: split fuzz into different files and binaries
This is in preparation to add more fuzzing code...
2020-02-17 22:05:46 +01:00