diff --git a/Makefile b/Makefile index dd5109a4a..1df37159d 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ lint: ## runs golangci-lint suite of linters check: test test: verifiers build ## builds minio, runs linters, tests @echo "Running unit tests" - @CGO_ENABLED=0 go test -tags kqueue ./... + @MINIO_API_REQUESTS_MAX=10000 CGO_ENABLED=0 go test -tags kqueue ./... test-decom: install @echo "Running minio decom tests" @@ -58,9 +58,9 @@ test-race: verifiers build ## builds minio, runs linters, tests (race) test-iam: build ## verify IAM (external IDP, etcd backends) @echo "Running tests for IAM (external IDP, etcd backends)" - @CGO_ENABLED=0 go test -tags kqueue -v -run TestIAM* ./cmd + @MINIO_API_REQUESTS_MAX=10000 CGO_ENABLED=0 go test -tags kqueue -v -run TestIAM* ./cmd @echo "Running tests for IAM (external IDP, etcd backends) with -race" - @GORACE=history_size=7 CGO_ENABLED=1 go test -race -tags kqueue -v -run TestIAM* ./cmd + @MINIO_API_REQUESTS_MAX=10000 GORACE=history_size=7 CGO_ENABLED=1 go test -race -tags kqueue -v -run TestIAM* ./cmd test-replication: install ## verify multi site replication @echo "Running tests for replicating three sites" diff --git a/buildscripts/race.sh b/buildscripts/race.sh index 6b3964fcc..4772c8818 100755 --- a/buildscripts/race.sh +++ b/buildscripts/race.sh @@ -3,6 +3,8 @@ set -e export GORACE="history_size=7" +export MINIO_API_REQUESTS_MAX=10000 + ## TODO remove `dsync` from race detector once this is merged and released https://go-review.googlesource.com/c/go/+/333529/ for d in $(go list ./... | grep -v dsync); do CGO_ENABLED=1 go test -v -race --timeout 100m "$d" diff --git a/internal/bucket/object/lock/lock.go b/internal/bucket/object/lock/lock.go index 734f65dfd..f02cef0a3 100644 --- a/internal/bucket/object/lock/lock.go +++ b/internal/bucket/object/lock/lock.go @@ -18,6 +18,7 @@ package lock import ( + "bytes" "context" "encoding/xml" "errors" @@ -529,8 +530,13 @@ func (l *ObjectLegalHold) IsEmpty() bool { // ParseObjectLegalHold decodes the XML into ObjectLegalHold func ParseObjectLegalHold(reader io.Reader) (hold *ObjectLegalHold, err error) { + buf, err := io.ReadAll(io.LimitReader(reader, maxObjectLockConfigSize)) + if err != nil { + return nil, err + } + hold = &ObjectLegalHold{} - if err = xml.NewDecoder(reader).Decode(hold); err != nil { + if err = xml.NewDecoder(bytes.NewReader(buf)).Decode(hold); err != nil { return nil, err }