From 390960c947ee7ddb2f323ef80f1ae93ea206c861 Mon Sep 17 00:00:00 2001 From: Christopher Puschmann Date: Fri, 15 Sep 2023 15:36:09 +0200 Subject: [PATCH] Limit maximum BER packet length in `FuzzParseDN` to 65536 bytes 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")