From 80095a39b5344c7bd824b1d93098d46f17041c17 Mon Sep 17 00:00:00 2001 From: Christopher Puschmann Date: Fri, 15 Sep 2023 16:34:59 +0200 Subject: [PATCH] fix: Limit maximum BER packet length in `FuzzParseDN` to 65536 bytes (#466) Parallel and large amount of fuzzing data can create large amounts of allocated data and cause restricted fuzzing environments to crash (see #460) --- fuzz_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fuzz_test.go b/fuzz_test.go index eeee720..fcbd87d 100644 --- a/fuzz_test.go +++ b/fuzz_test.go @@ -3,9 +3,15 @@ package ldap -import "testing" +import ( + ber "github.com/go-asn1-ber/asn1-ber" + "testing" +) func FuzzParseDN(f *testing.F) { + // See https://github.com/go-asn1-ber/asn1-ber/blob/04301b4b1c5ff66221f8f8a394f814a9917d678a/fuzz_test.go#L33-L37 + // for why this limitation is necessary + ber.MaxPacketLengthBytes = 65536 f.Add("*") f.Add("cn=Jim\\0Test")