15 Commits

Author SHA1 Message Date
Erik Dubbelboer a95a1ad11c Only normalize pre-colon whitespace for HTTP headers (#2172)
Keep headerScanner strict so malformed MIME header lines are still rejected.

Move trimming before ':' into the HTTP header handling paths that
intentionally normalize header names, and add a fuzz seed for the
regression case.
2026-04-04 04:24:04 +02:00
Erik Dubbelboer 3471acf23f Limit url length in FuzzURIParse
We had fuzzers use urls of 500kb which doesn't make sense to test with.
2026-01-30 22:55:42 +01:00
Erik Dubbelboer ede09fad73 Limit FuzzTestHeaderScanner body size 2025-10-03 05:03:38 +02:00
Erik Dubbelboer f9d84d7c52 Rewrite header parsing to improve spec compliance (#2030)
This change updates header parsing to match the behavior of net/http more closely.

**Breaking change**: headers delimited by `\n` (instead of `\r\n`) are no longer supported.

Previously, fasthttp accepted `\n` as a delimiter, which is not spec compliant.
This made it difficult to correctly parse headers containing both `\n` and `\r\n`.
2025-08-12 15:49:35 +02:00
Erik Dubbelboer b8969ed8dc Fix normalizeHeaderValue (#1963)
The fuzzer found some cases where it would panic.

The output of normalizeHeaderValue doesn't need to affect s.b and s.hLen
because the length of the normalized header will never be bigger, so it
can just be normalize in place without affecting the rest of the buffer.
2025-02-22 08:33:57 +01:00
Erik Dubbelboer 705ad0079a Fix parsing of bad urls with # (#1915)
http://google.com#@github.com parses incorrectly as github.com instead
of google.com.

Reported by Jesse Yang
2024-12-18 07:54:39 +01:00
Erik Dubbelboer c3050516d9 Fix lint and security issues
gosec was failing after the last update introduced some new checks.
2024-09-07 15:22:05 +02:00
Erik Dubbelboer f9f213efa6 Prevent OOM when fuzzing 2024-05-18 10:30:23 +02:00
Erik Dubbelboer 8f5b927447 Try to fix oss-fuzz low memory limit again 2024-05-08 09:57:57 +02:00
Erik Dubbelboer 4c326e8f6c Limit memory for fuzz testing
CIFuzz has low memory limits that we keep hitting without there being an
issue.
2024-02-21 06:02:19 +01:00
Oleksandr Redko 190204cf1a Upgrade golangci-lint to v1.56.2; fix gocritic issues (#1722) 2024-02-21 05:51:28 +01:00
Erik Dubbelboer 48dd2d0ce7 Try fixing oss-fuzz running out of memory and skipping a lot 2024-01-30 08:01:06 +01:00
Erik Dubbelboer 287e3616ba Make Fuzz tests deterministic
From the Go docs:
- Fuzz targets should be fast and deterministic so the fuzzing engine can work efficiently, and new failures and code coverage can be easily reproduced.
- Since the fuzz target is invoked in parallel across multiple workers and in nondeterministic order, the state of a fuzz target should not persist past the end of each call, and the behavior of a fuzz target should not depend on global state.
2024-01-20 05:10:41 +01:00
Erik Dubbelboer c205a253b4 Put a limit on the max body size for fuzzing 2024-01-16 05:07:21 +01:00
Erik Dubbelboer a04cd8c39f Move Fuzz tests into their own file
This is required for https://github.com/google/oss-fuzz/pull/11453
2024-01-09 13:01:31 +01:00